Deploy public demo governance d525f15
Browse files- .gitattributes +0 -19
- README.md +7 -6
- assets/st3gg_examples.json +22 -0
- docs/HACKATHON_EVALUATION.md +4 -3
- docs/HANDOFF_FINAL_HACKATHON.md +8 -5
- src/nexus_visual_weaver/catalog.py +43 -6
- src/nexus_visual_weaver/hf_runtime.py +4 -3
- src/nexus_visual_weaver/model_relay.py +19 -5
- src/nexus_visual_weaver/render.py +41 -74
- src/nexus_visual_weaver/schema.py +1 -1
- src/nexus_visual_weaver/styles.py +49 -0
- tests/fixtures/st3gg_blocked_trailing.png +0 -0
- tests/fixtures/st3gg_safe_clean.png +0 -0
- tests/test_command_center.py +34 -2
- tests/test_hf_runtime.py +7 -1
- tests/test_model_relay.py +14 -4
.gitattributes
CHANGED
|
@@ -9,22 +9,3 @@
|
|
| 9 |
*.jpeg binary
|
| 10 |
*.webp binary
|
| 11 |
|
| 12 |
-
outputs/moodboards/nexus-raven-command-center/generated/artifact-preview-lane.png filter=lfs diff=lfs merge=lfs -text
|
| 13 |
-
outputs/moodboards/nexus-raven-command-center/generated/cyber-atelier-desk.png filter=lfs diff=lfs merge=lfs -text
|
| 14 |
-
outputs/moodboards/nexus-raven-command-center/generated/gmr-provider-cards.png filter=lfs diff=lfs merge=lfs -text
|
| 15 |
-
outputs/moodboards/nexus-raven-command-center/generated/gothic-material-study.png filter=lfs diff=lfs merge=lfs -text
|
| 16 |
-
outputs/moodboards/nexus-raven-command-center/generated/hackathon-judge-view.png filter=lfs diff=lfs merge=lfs -text
|
| 17 |
-
outputs/moodboards/nexus-raven-command-center/generated/judge-inspector-glass.png filter=lfs diff=lfs merge=lfs -text
|
| 18 |
-
outputs/moodboards/nexus-raven-command-center/generated/lore-timeline.png filter=lfs diff=lfs merge=lfs -text
|
| 19 |
-
outputs/moodboards/nexus-raven-command-center/generated/nvidia-grounding-anchor.png filter=lfs diff=lfs merge=lfs -text
|
| 20 |
-
outputs/moodboards/nexus-raven-command-center/generated/runway-to-tool-bridge.png filter=lfs diff=lfs merge=lfs -text
|
| 21 |
-
outputs/moodboards/nexus-raven-command-center/generated/st3gg-purification-gate.png filter=lfs diff=lfs merge=lfs -text
|
| 22 |
-
outputs/moodboards/nexus-raven-command-center/generated/wardrobe-drawer.png filter=lfs diff=lfs merge=lfs -text
|
| 23 |
-
outputs/moodboards/nexus-raven-command-center/generated/workflow-command-spine.png filter=lfs diff=lfs merge=lfs -text
|
| 24 |
-
outputs/moodboards/nexus-raven-command-center/verification-contact-sheet.jpg filter=lfs diff=lfs merge=lfs -text
|
| 25 |
-
outputs/space-deploy-3910cf6.tar filter=lfs diff=lfs merge=lfs -text
|
| 26 |
-
outputs/space-deploy-3f8b48e.tar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
-
outputs/space-deploy-68a5636.tar filter=lfs diff=lfs merge=lfs -text
|
| 28 |
-
outputs/space-deploy-b44cbe3.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
-
outputs/space-deploy-d68f4e5.tar filter=lfs diff=lfs merge=lfs -text
|
| 30 |
-
outputs/space-deploy-f7eaa94.tar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 9 |
*.jpeg binary
|
| 10 |
*.webp binary
|
| 11 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
README.md
CHANGED
|
@@ -10,7 +10,7 @@ pinned: false
|
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Governed gothic couture visual creation command center
|
| 12 |
models:
|
| 13 |
-
- black-forest-labs/FLUX.2-klein-
|
| 14 |
- nvidia/LocateAnything-3B
|
| 15 |
- openbmb/MiniCPM-V-4.6
|
| 16 |
- nvidia/NVIDIA-Nemotron-Parse-v1.2
|
|
@@ -49,7 +49,7 @@ The interface is built around a command-center surface:
|
|
| 49 |
|
| 50 |
Pinned lanes do not rotate:
|
| 51 |
|
| 52 |
-
- `image_generation`: FLUX.2
|
| 53 |
- `grounding`: NVIDIA LocateAnything-3B grounding anchor
|
| 54 |
- `security`: ST3GG defensive scanner/export gate
|
| 55 |
|
|
@@ -67,12 +67,13 @@ Helper lanes may rotate with quota, license, health, and parameter-budget checks
|
|
| 67 |
- HF catalog research
|
| 68 |
- Modal job runner
|
| 69 |
|
| 70 |
-
Public demo mode excludes private, commercial-uncleared, and research-only helper models. Private research mode
|
| 71 |
|
| 72 |
## Current Features
|
| 73 |
|
| 74 |
- Gradio Blocks dashboard with split update regions.
|
| 75 |
-
- Real FLUX.2 Klein image generation on Hugging Face ZeroGPU when
|
|
|
|
| 76 |
- Generated artifact ST3GG scan and checkpoint/export state.
|
| 77 |
- Optional MiniCPM-V and Nemotron provider evidence lanes with explicit configured/missing-secret status.
|
| 78 |
- Active workflow graph and checkpointed run record.
|
|
@@ -88,7 +89,7 @@ Public demo mode excludes private, commercial-uncleared, and research-only helpe
|
|
| 88 |
| Target | Evidence status |
|
| 89 |
| --- | --- |
|
| 90 |
| Gradio Space | App runs as a public Hugging Face Gradio Space with `mcp_server=True`. |
|
| 91 |
-
| <=32B models |
|
| 92 |
| Off Brand | Custom command-center UI, dense inspector, workflow graph, wardrobe/lore drawer, and provider cards. |
|
| 93 |
| Best Agent | Multi-step prompt, generation, scan, judge, checkpoint, export workflow. |
|
| 94 |
| OpenBMB | Claimed only when MiniCPM-V returns judge evidence in an export packet. |
|
|
@@ -96,7 +97,7 @@ Public demo mode excludes private, commercial-uncleared, and research-only helpe
|
|
| 96 |
| OpenAI Codex | Development branch and PR include Codex-authored implementation commits. |
|
| 97 |
| Demo / social | Add final links here before submission: `DEMO_VIDEO_URL` and `SOCIAL_POST_URL`. |
|
| 98 |
|
| 99 |
-
Tiny Titan
|
| 100 |
|
| 101 |
## Local Setup
|
| 102 |
|
|
|
|
| 10 |
license: apache-2.0
|
| 11 |
short_description: Governed gothic couture visual creation command center
|
| 12 |
models:
|
| 13 |
+
- black-forest-labs/FLUX.2-klein-4B
|
| 14 |
- nvidia/LocateAnything-3B
|
| 15 |
- openbmb/MiniCPM-V-4.6
|
| 16 |
- nvidia/NVIDIA-Nemotron-Parse-v1.2
|
|
|
|
| 49 |
|
| 50 |
Pinned lanes do not rotate:
|
| 51 |
|
| 52 |
+
- `image_generation`: public-demo FLUX.2 Klein 4B image lane
|
| 53 |
- `grounding`: NVIDIA LocateAnything-3B grounding anchor
|
| 54 |
- `security`: ST3GG defensive scanner/export gate
|
| 55 |
|
|
|
|
| 67 |
- HF catalog research
|
| 68 |
- Modal job runner
|
| 69 |
|
| 70 |
+
Public demo mode excludes private, commercial-uncleared, and research-only helper models. Private research mode keeps the gated FLUX.2 Klein 9B and OFFELLIA/Gemma routes available, but it never disables consent, provenance, ST3GG, export, or dataset-partition gates.
|
| 71 |
|
| 72 |
## Current Features
|
| 73 |
|
| 74 |
- Gradio Blocks dashboard with split update regions.
|
| 75 |
+
- Real FLUX.2 Klein 4B image generation on Hugging Face ZeroGPU when runtime access is configured.
|
| 76 |
+
- Above-fold ST3GG trust strip with safe-vs-blocked fixture evidence.
|
| 77 |
- Generated artifact ST3GG scan and checkpoint/export state.
|
| 78 |
- Optional MiniCPM-V and Nemotron provider evidence lanes with explicit configured/missing-secret status.
|
| 79 |
- Active workflow graph and checkpointed run record.
|
|
|
|
| 89 |
| Target | Evidence status |
|
| 90 |
| --- | --- |
|
| 91 |
| Gradio Space | App runs as a public Hugging Face Gradio Space with `mcp_server=True`. |
|
| 92 |
+
| <=32B models | Public stack is 11.42B: FLUX.2 Klein 4B + LocateAnything 3.83B + MiniCPM-V 1.30B + Nemotron Parse 0.94B + MiniCPM5 1.08B + FunctionGemma 0.27B. |
|
| 93 |
| Off Brand | Custom command-center UI, dense inspector, workflow graph, wardrobe/lore drawer, and provider cards. |
|
| 94 |
| Best Agent | Multi-step prompt, generation, scan, judge, checkpoint, export workflow. |
|
| 95 |
| OpenBMB | Claimed only when MiniCPM-V returns judge evidence in an export packet. |
|
|
|
|
| 97 |
| OpenAI Codex | Development branch and PR include Codex-authored implementation commits. |
|
| 98 |
| Demo / social | Add final links here before submission: `DEMO_VIDEO_URL` and `SOCIAL_POST_URL`. |
|
| 99 |
|
| 100 |
+
Tiny Titan can be claimed for the public demo stack because the active public models are each <=4B. The stronger FLUX.2 Klein 9B and OFFELLIA/Gemma stack remains private research only.
|
| 101 |
|
| 102 |
## Local Setup
|
| 103 |
|
assets/st3gg_examples.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"version": "v2.3",
|
| 3 |
+
"trust_model": "Generation is not export. Every artifact must pass ST3GG scan, purification, and human checkpoint before release.",
|
| 4 |
+
"examples": [
|
| 5 |
+
{
|
| 6 |
+
"id": "safe_clean_png",
|
| 7 |
+
"label": "Safe clean PNG",
|
| 8 |
+
"filename": "st3gg_safe_clean.png",
|
| 9 |
+
"expected_status": "pass",
|
| 10 |
+
"expected_export_gate": "clear",
|
| 11 |
+
"note": "Valid PNG signature and no trailing bytes after IEND."
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"id": "blocked_png_trailing_data",
|
| 15 |
+
"label": "Blocked PNG with trailing data",
|
| 16 |
+
"filename": "st3gg_blocked_trailing.png",
|
| 17 |
+
"expected_status": "review",
|
| 18 |
+
"expected_export_gate": "blocked",
|
| 19 |
+
"note": "Valid PNG signature with extra bytes after the IEND marker."
|
| 20 |
+
}
|
| 21 |
+
]
|
| 22 |
+
}
|
docs/HACKATHON_EVALUATION.md
CHANGED
|
@@ -13,9 +13,10 @@ NEXUS Visual Weaver should open as a working command center, not a landing page.
|
|
| 13 |
## Current Strengths
|
| 14 |
|
| 15 |
- Gradio-compatible app shape with `mcp_server=True`.
|
| 16 |
-
- Pinned model governance is visible: FLUX.2, LocateAnything-3B, and ST3GG.
|
| 17 |
-
- Real FLUX.2 generation is wired for HF Space and falls back to an honest dry-run state outside Space.
|
| 18 |
- Generated artifacts are scanned by ST3GG before checkpoint/export.
|
|
|
|
| 19 |
- OpenBMB MiniCPM-V 4.6 and NVIDIA Nemotron evidence lanes are represented as real optional provider adapters with missing-secret/failed/success states.
|
| 20 |
- Adult Mode starts off and is framed as catalog scope, not a safety bypass.
|
| 21 |
- ModelRelay/GMR helper rotation is represented without replacing pinned lanes.
|
|
@@ -47,5 +48,5 @@ NEXUS Visual Weaver should open as a working command center, not a landing page.
|
|
| 47 |
| OpenBMB | Claim only after MiniCPM-V returns `success` in export evidence. |
|
| 48 |
| NVIDIA | Claim only after Nemotron returns `success` in export evidence. |
|
| 49 |
| OpenAI Codex | GitHub branch/PR provides Codex development trail. |
|
| 50 |
-
| Tiny Titan |
|
| 51 |
| Modal | Not claimed unless a real Modal job runs. |
|
|
|
|
| 13 |
## Current Strengths
|
| 14 |
|
| 15 |
- Gradio-compatible app shape with `mcp_server=True`.
|
| 16 |
+
- Pinned model governance is visible: FLUX.2 Klein 4B, LocateAnything-3B, and ST3GG.
|
| 17 |
+
- Real FLUX.2 Klein 4B generation is wired for HF Space and falls back to an honest dry-run state outside Space.
|
| 18 |
- Generated artifacts are scanned by ST3GG before checkpoint/export.
|
| 19 |
+
- Above-fold trust strip makes ST3GG verdict, export gate, fixture evidence, and adult-mode safety boundaries visible immediately.
|
| 20 |
- OpenBMB MiniCPM-V 4.6 and NVIDIA Nemotron evidence lanes are represented as real optional provider adapters with missing-secret/failed/success states.
|
| 21 |
- Adult Mode starts off and is framed as catalog scope, not a safety bypass.
|
| 22 |
- ModelRelay/GMR helper rotation is represented without replacing pinned lanes.
|
|
|
|
| 48 |
| OpenBMB | Claim only after MiniCPM-V returns `success` in export evidence. |
|
| 49 |
| NVIDIA | Claim only after Nemotron returns `success` in export evidence. |
|
| 50 |
| OpenAI Codex | GitHub branch/PR provides Codex development trail. |
|
| 51 |
+
| Tiny Titan | Public demo stack is eligible: active public models are each <=4B. |
|
| 52 |
| Modal | Not claimed unless a real Modal job runs. |
|
docs/HANDOFF_FINAL_HACKATHON.md
CHANGED
|
@@ -6,13 +6,15 @@
|
|
| 6 |
- Working branch: `codex/specimba/ui-polish-command-center`
|
| 7 |
- HF Space: `build-small-hackathon/NEXUS_Visual_Weaver`
|
| 8 |
- Public Space URL: `https://build-small-hackathon-nexus-visual-weaver-a107340.hf.space/`
|
| 9 |
-
-
|
|
|
|
|
|
|
| 10 |
|
| 11 |
## Secrets Needed
|
| 12 |
|
| 13 |
Do not paste these into chat, commits, logs, or export packets.
|
| 14 |
|
| 15 |
-
- `HF_TOKEN`:
|
| 16 |
- `MINICPM_BASE_URL`: OpenBMB OpenAI-compatible endpoint base URL.
|
| 17 |
- `MINICPM_API_KEY`: OpenBMB bearer token.
|
| 18 |
- `MINICPM_MODEL`: default `MiniCPM-V-4.6`.
|
|
@@ -37,7 +39,7 @@ Avoid pytest `--basetemp=C:\tmp` in this Windows sandbox if `tmp_path` fixtures
|
|
| 37 |
## Runtime Flow
|
| 38 |
|
| 39 |
1. `run_active_weave` builds the Raven Chronicle run packet.
|
| 40 |
-
2. FLUX.2 generates the image on Space when HF runtime is enabled.
|
| 41 |
3. Generated artifact is scanned by ST3GG.
|
| 42 |
4. MiniCPM-V judge runs when OpenBMB secrets are present.
|
| 43 |
5. Nemotron evidence runs when Nemotron/NVIDIA endpoint secrets are present.
|
|
@@ -49,13 +51,14 @@ Avoid pytest `--basetemp=C:\tmp` in this Windows sandbox if `tmp_path` fixtures
|
|
| 49 |
- OpenBMB prize claim requires `minicpm_judge.status == "success"` in an export packet.
|
| 50 |
- NVIDIA prize claim requires `nemotron_evidence.status == "success"` in an export packet.
|
| 51 |
- LocateAnything supports the grounding story but does not replace Nemotron for the NVIDIA prize.
|
| 52 |
-
- Tiny Titan
|
|
|
|
| 53 |
- Modal is not claimed unless a real Modal job runs and is documented.
|
| 54 |
|
| 55 |
## Known Risks
|
| 56 |
|
| 57 |
- GitHub CLI may fail behind proxy `127.0.0.1:9`; use local git status and HF verification when blocked.
|
| 58 |
-
- Real FLUX generation depends on Space GPU availability and
|
| 59 |
- OpenBMB and Nemotron endpoints are optional and must show `missing secret` rather than fake success when not configured.
|
| 60 |
- Demo video and social post links must be added before final submission.
|
| 61 |
|
|
|
|
| 6 |
- Working branch: `codex/specimba/ui-polish-command-center`
|
| 7 |
- HF Space: `build-small-hackathon/NEXUS_Visual_Weaver`
|
| 8 |
- Public Space URL: `https://build-small-hackathon-nexus-visual-weaver-a107340.hf.space/`
|
| 9 |
+
- HF rollback SHA: `410a467c55d11e7308249198bd5fe0b2c190aec6`.
|
| 10 |
+
- Branch discipline: use only `main` and `codex/specimba/ui-polish-command-center`; no extra recovery branches.
|
| 11 |
+
- Primary goal: finish a countable Build Small submission with real FLUX.2 4B generation, ST3GG scan, optional OpenBMB MiniCPM-V judge evidence, optional NVIDIA Nemotron evidence, checkpointed export packet, README prize mapping, demo video, and social post.
|
| 12 |
|
| 13 |
## Secrets Needed
|
| 14 |
|
| 15 |
Do not paste these into chat, commits, logs, or export packets.
|
| 16 |
|
| 17 |
+
- `HF_TOKEN`: optional for public FLUX.2 Klein 4B access and required only if private/gated research lanes are enabled.
|
| 18 |
- `MINICPM_BASE_URL`: OpenBMB OpenAI-compatible endpoint base URL.
|
| 19 |
- `MINICPM_API_KEY`: OpenBMB bearer token.
|
| 20 |
- `MINICPM_MODEL`: default `MiniCPM-V-4.6`.
|
|
|
|
| 39 |
## Runtime Flow
|
| 40 |
|
| 41 |
1. `run_active_weave` builds the Raven Chronicle run packet.
|
| 42 |
+
2. FLUX.2 Klein 4B generates the image on Space when HF runtime is enabled.
|
| 43 |
3. Generated artifact is scanned by ST3GG.
|
| 44 |
4. MiniCPM-V judge runs when OpenBMB secrets are present.
|
| 45 |
5. Nemotron evidence runs when Nemotron/NVIDIA endpoint secrets are present.
|
|
|
|
| 51 |
- OpenBMB prize claim requires `minicpm_judge.status == "success"` in an export packet.
|
| 52 |
- NVIDIA prize claim requires `nemotron_evidence.status == "success"` in an export packet.
|
| 53 |
- LocateAnything supports the grounding story but does not replace Nemotron for the NVIDIA prize.
|
| 54 |
+
- Tiny Titan can be claimed for the public demo stack because each active public model is <=4B.
|
| 55 |
+
- FLUX.2 Klein 9B and OFFELLIA/Gemma remain private research options only.
|
| 56 |
- Modal is not claimed unless a real Modal job runs and is documented.
|
| 57 |
|
| 58 |
## Known Risks
|
| 59 |
|
| 60 |
- GitHub CLI may fail behind proxy `127.0.0.1:9`; use local git status and HF verification when blocked.
|
| 61 |
+
- Real FLUX generation depends on Space GPU availability and the public 4B runtime loading successfully.
|
| 62 |
- OpenBMB and Nemotron endpoints are optional and must show `missing secret` rather than fake success when not configured.
|
| 63 |
- Demo video and social post links must be added before final submission.
|
| 64 |
|
src/nexus_visual_weaver/catalog.py
CHANGED
|
@@ -6,22 +6,33 @@ from .schema import AdapterRecipe, ModelCandidate
|
|
| 6 |
|
| 7 |
MODEL_CATALOG: list[ModelCandidate] = [
|
| 8 |
ModelCandidate(
|
| 9 |
-
repo_id="black-forest-labs/FLUX.2-klein-
|
| 10 |
role="image_generator",
|
| 11 |
task="image-to-image",
|
| 12 |
-
params_b=
|
| 13 |
runtime="diffusers / provider",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
license="other",
|
| 15 |
gated=True,
|
|
|
|
| 16 |
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-9B",
|
| 17 |
),
|
| 18 |
ModelCandidate(
|
| 19 |
repo_id="Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 20 |
-
role="
|
| 21 |
task="image-text-to-text",
|
| 22 |
params_b=12.0,
|
| 23 |
runtime="llama.cpp GGUF",
|
| 24 |
license="apache-2.0",
|
|
|
|
| 25 |
source_url="https://hf.co/Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 26 |
),
|
| 27 |
ModelCandidate(
|
|
@@ -102,10 +113,22 @@ MODEL_CATALOG: list[ModelCandidate] = [
|
|
| 102 |
ADAPTER_CATALOG: list[AdapterRecipe] = [
|
| 103 |
AdapterRecipe(
|
| 104 |
repo_id="DeverStyle/Flux.2-Klein-Loras",
|
| 105 |
-
adapter_for="black-forest-labs/FLUX.2-klein-
|
| 106 |
task="text-to-image style stack",
|
| 107 |
license="apache-2.0",
|
| 108 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 109 |
AdapterRecipe(
|
| 110 |
repo_id="nomadoor/flux-2-klein-9B-schematic-lora",
|
| 111 |
adapter_for="black-forest-labs/FLUX.2-klein-base-9B",
|
|
@@ -147,6 +170,15 @@ ADAPTER_CATALOG: list[AdapterRecipe] = [
|
|
| 147 |
]
|
| 148 |
|
| 149 |
DEFAULT_ACTIVE_STACK = [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
"black-forest-labs/FLUX.2-klein-9B",
|
| 151 |
"Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 152 |
"nvidia/LocateAnything-3B",
|
|
@@ -157,7 +189,11 @@ DEFAULT_ACTIVE_STACK = [
|
|
| 157 |
|
| 158 |
|
| 159 |
def filter_catalog(adult_mode: bool = False) -> tuple[list[ModelCandidate], list[AdapterRecipe]]:
|
| 160 |
-
models = [
|
|
|
|
|
|
|
|
|
|
|
|
|
| 161 |
adapters = [adapter for adapter in ADAPTER_CATALOG if adult_mode or not adapter.adult_only]
|
| 162 |
return models, adapters
|
| 163 |
|
|
@@ -165,7 +201,8 @@ def filter_catalog(adult_mode: bool = False) -> tuple[list[ModelCandidate], list
|
|
| 165 |
def active_stack(adult_mode: bool = False) -> list[ModelCandidate]:
|
| 166 |
allowed, _ = filter_catalog(adult_mode)
|
| 167 |
by_id = {model.repo_id: model for model in allowed}
|
| 168 |
-
|
|
|
|
| 169 |
|
| 170 |
|
| 171 |
def parameter_budget(stack: list[ModelCandidate] | None = None) -> dict[str, float | str]:
|
|
|
|
| 6 |
|
| 7 |
MODEL_CATALOG: list[ModelCandidate] = [
|
| 8 |
ModelCandidate(
|
| 9 |
+
repo_id="black-forest-labs/FLUX.2-klein-4B",
|
| 10 |
role="image_generator",
|
| 11 |
task="image-to-image",
|
| 12 |
+
params_b=4.0,
|
| 13 |
runtime="diffusers / provider",
|
| 14 |
+
license="apache-2.0",
|
| 15 |
+
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-4B",
|
| 16 |
+
),
|
| 17 |
+
ModelCandidate(
|
| 18 |
+
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 19 |
+
role="private_research_image_generator",
|
| 20 |
+
task="image-to-image",
|
| 21 |
+
params_b=9.0,
|
| 22 |
+
runtime="diffusers / gated provider",
|
| 23 |
license="other",
|
| 24 |
gated=True,
|
| 25 |
+
public_demo=False,
|
| 26 |
source_url="https://hf.co/black-forest-labs/FLUX.2-klein-9B",
|
| 27 |
),
|
| 28 |
ModelCandidate(
|
| 29 |
repo_id="Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 30 |
+
role="private_research_multimodal_judge",
|
| 31 |
task="image-text-to-text",
|
| 32 |
params_b=12.0,
|
| 33 |
runtime="llama.cpp GGUF",
|
| 34 |
license="apache-2.0",
|
| 35 |
+
public_demo=False,
|
| 36 |
source_url="https://hf.co/Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 37 |
),
|
| 38 |
ModelCandidate(
|
|
|
|
| 113 |
ADAPTER_CATALOG: list[AdapterRecipe] = [
|
| 114 |
AdapterRecipe(
|
| 115 |
repo_id="DeverStyle/Flux.2-Klein-Loras",
|
| 116 |
+
adapter_for="black-forest-labs/FLUX.2-klein-4B",
|
| 117 |
task="text-to-image style stack",
|
| 118 |
license="apache-2.0",
|
| 119 |
),
|
| 120 |
+
AdapterRecipe(
|
| 121 |
+
repo_id="fal/flux-2-klein-4B-outpaint-lora",
|
| 122 |
+
adapter_for="black-forest-labs/FLUX.2-klein-4B",
|
| 123 |
+
task="outpaint/inpaint public demo helper",
|
| 124 |
+
license="apache-2.0",
|
| 125 |
+
),
|
| 126 |
+
AdapterRecipe(
|
| 127 |
+
repo_id="thedeoxen/refcontrol-FLUX.2-klein-4B-reference-depth-lora",
|
| 128 |
+
adapter_for="black-forest-labs/FLUX.2-klein-base-4B",
|
| 129 |
+
task="reference-depth control for garment layout",
|
| 130 |
+
license="apache-2.0",
|
| 131 |
+
),
|
| 132 |
AdapterRecipe(
|
| 133 |
repo_id="nomadoor/flux-2-klein-9B-schematic-lora",
|
| 134 |
adapter_for="black-forest-labs/FLUX.2-klein-base-9B",
|
|
|
|
| 170 |
]
|
| 171 |
|
| 172 |
DEFAULT_ACTIVE_STACK = [
|
| 173 |
+
"black-forest-labs/FLUX.2-klein-4B",
|
| 174 |
+
"nvidia/LocateAnything-3B",
|
| 175 |
+
"openbmb/MiniCPM-V-4.6",
|
| 176 |
+
"nvidia/NVIDIA-Nemotron-Parse-v1.2",
|
| 177 |
+
"openbmb/MiniCPM5-1B",
|
| 178 |
+
"onnx-community/functiongemma-270m-it-ONNX",
|
| 179 |
+
]
|
| 180 |
+
|
| 181 |
+
PRIVATE_RESEARCH_STACK = [
|
| 182 |
"black-forest-labs/FLUX.2-klein-9B",
|
| 183 |
"Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf",
|
| 184 |
"nvidia/LocateAnything-3B",
|
|
|
|
| 189 |
|
| 190 |
|
| 191 |
def filter_catalog(adult_mode: bool = False) -> tuple[list[ModelCandidate], list[AdapterRecipe]]:
|
| 192 |
+
models = [
|
| 193 |
+
model
|
| 194 |
+
for model in MODEL_CATALOG
|
| 195 |
+
if (adult_mode or not model.adult_only) and (adult_mode or model.public_demo)
|
| 196 |
+
]
|
| 197 |
adapters = [adapter for adapter in ADAPTER_CATALOG if adult_mode or not adapter.adult_only]
|
| 198 |
return models, adapters
|
| 199 |
|
|
|
|
| 201 |
def active_stack(adult_mode: bool = False) -> list[ModelCandidate]:
|
| 202 |
allowed, _ = filter_catalog(adult_mode)
|
| 203 |
by_id = {model.repo_id: model for model in allowed}
|
| 204 |
+
stack_ids = PRIVATE_RESEARCH_STACK if adult_mode else DEFAULT_ACTIVE_STACK
|
| 205 |
+
return [by_id[repo_id] for repo_id in stack_ids if repo_id in by_id]
|
| 206 |
|
| 207 |
|
| 208 |
def parameter_budget(stack: list[ModelCandidate] | None = None) -> dict[str, float | str]:
|
src/nexus_visual_weaver/hf_runtime.py
CHANGED
|
@@ -9,7 +9,8 @@ from pathlib import Path
|
|
| 9 |
from typing import Any
|
| 10 |
|
| 11 |
|
| 12 |
-
FLUX_REPO_ID = "black-forest-labs/FLUX.2-klein-
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
@dataclass(frozen=True)
|
|
@@ -98,7 +99,7 @@ def generate_flux_image(prompt: str, *, seed: int = 0, width: int = 1024, height
|
|
| 98 |
status="no_cuda",
|
| 99 |
provider_state="blocked",
|
| 100 |
repo_id=FLUX_REPO_ID,
|
| 101 |
-
message="CUDA is not available to the Space callback; FLUX.2
|
| 102 |
width=width,
|
| 103 |
height=height,
|
| 104 |
steps=steps,
|
|
@@ -126,7 +127,7 @@ def generate_flux_image(prompt: str, *, seed: int = 0, width: int = 1024, height
|
|
| 126 |
provider_state="generated",
|
| 127 |
repo_id=FLUX_REPO_ID,
|
| 128 |
output_path=str(output_path),
|
| 129 |
-
message="FLUX.2 Klein generated a real
|
| 130 |
latency_seconds=round(time.perf_counter() - started, 2),
|
| 131 |
width=width,
|
| 132 |
height=height,
|
|
|
|
| 9 |
from typing import Any
|
| 10 |
|
| 11 |
|
| 12 |
+
FLUX_REPO_ID = "black-forest-labs/FLUX.2-klein-4B"
|
| 13 |
+
PRIVATE_RESEARCH_FLUX_REPO_ID = "black-forest-labs/FLUX.2-klein-9B"
|
| 14 |
|
| 15 |
|
| 16 |
@dataclass(frozen=True)
|
|
|
|
| 99 |
status="no_cuda",
|
| 100 |
provider_state="blocked",
|
| 101 |
repo_id=FLUX_REPO_ID,
|
| 102 |
+
message="CUDA is not available to the Space callback; FLUX.2 Klein 4B requires GPU execution.",
|
| 103 |
width=width,
|
| 104 |
height=height,
|
| 105 |
steps=steps,
|
|
|
|
| 127 |
provider_state="generated",
|
| 128 |
repo_id=FLUX_REPO_ID,
|
| 129 |
output_path=str(output_path),
|
| 130 |
+
message="FLUX.2 Klein 4B generated a real public-demo artifact on HF Space.",
|
| 131 |
latency_seconds=round(time.perf_counter() - started, 2),
|
| 132 |
width=width,
|
| 133 |
height=height,
|
src/nexus_visual_weaver/model_relay.py
CHANGED
|
@@ -15,6 +15,7 @@ from typing import Any
|
|
| 15 |
|
| 16 |
PINNED_LANES = {"image_generation", "grounding", "security"}
|
| 17 |
ROTATABLE_LANES = {
|
|
|
|
| 18 |
"prompt_router",
|
| 19 |
"taste_judge",
|
| 20 |
"audio_lore_tts",
|
|
@@ -430,18 +431,31 @@ class WeaverModelRelay:
|
|
| 430 |
def default_model_records() -> list[ModelRecord]:
|
| 431 |
return [
|
| 432 |
ModelRecord(
|
| 433 |
-
model_id="flux2-klein-
|
| 434 |
lane="image_generation",
|
| 435 |
provider="hf",
|
| 436 |
-
repo_id="black-forest-labs/FLUX.2-klein-
|
| 437 |
-
license_gate="
|
| 438 |
-
params_b=
|
| 439 |
cost_hint="provider_or_local",
|
| 440 |
rpm_limit=8,
|
| 441 |
rpd_limit=60,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 442 |
quality_score=0.96,
|
| 443 |
latency_ms=26000,
|
| 444 |
-
pinned=True,
|
| 445 |
),
|
| 446 |
ModelRecord(
|
| 447 |
model_id="locateanything-3b-anchor",
|
|
|
|
| 15 |
|
| 16 |
PINNED_LANES = {"image_generation", "grounding", "security"}
|
| 17 |
ROTATABLE_LANES = {
|
| 18 |
+
"private_image_research",
|
| 19 |
"prompt_router",
|
| 20 |
"taste_judge",
|
| 21 |
"audio_lore_tts",
|
|
|
|
| 431 |
def default_model_records() -> list[ModelRecord]:
|
| 432 |
return [
|
| 433 |
ModelRecord(
|
| 434 |
+
model_id="flux2-klein-4b-public",
|
| 435 |
lane="image_generation",
|
| 436 |
provider="hf",
|
| 437 |
+
repo_id="black-forest-labs/FLUX.2-klein-4B",
|
| 438 |
+
license_gate="apache-2.0",
|
| 439 |
+
params_b=4.0,
|
| 440 |
cost_hint="provider_or_local",
|
| 441 |
rpm_limit=8,
|
| 442 |
rpd_limit=60,
|
| 443 |
+
quality_score=0.92,
|
| 444 |
+
latency_ms=21000,
|
| 445 |
+
pinned=True,
|
| 446 |
+
),
|
| 447 |
+
ModelRecord(
|
| 448 |
+
model_id="flux2-klein-9b-private",
|
| 449 |
+
lane="private_image_research",
|
| 450 |
+
provider="hf",
|
| 451 |
+
repo_id="black-forest-labs/FLUX.2-klein-9B",
|
| 452 |
+
license_gate="review_required",
|
| 453 |
+
params_b=9.0,
|
| 454 |
+
cost_hint="gated_provider_or_private_space",
|
| 455 |
+
rpm_limit=6,
|
| 456 |
+
rpd_limit=40,
|
| 457 |
quality_score=0.96,
|
| 458 |
latency_ms=26000,
|
|
|
|
| 459 |
),
|
| 460 |
ModelRecord(
|
| 461 |
model_id="locateanything-3b-anchor",
|
src/nexus_visual_weaver/render.py
CHANGED
|
@@ -9,7 +9,6 @@ from pathlib import Path
|
|
| 9 |
|
| 10 |
from .catalog import catalog_summary, parameter_budget
|
| 11 |
from .schema import GenerationRun
|
| 12 |
-
from .workflow import WorkflowState
|
| 13 |
|
| 14 |
|
| 15 |
def badge(label: str, tone: str = "neutral") -> str:
|
|
@@ -83,13 +82,6 @@ def _image_data_uri(path: str | None) -> str | None:
|
|
| 83 |
return f"data:{mime};base64,{data}"
|
| 84 |
|
| 85 |
|
| 86 |
-
def render_command_header() -> str:
|
| 87 |
-
"""
|
| 88 |
-
Render the command input header section with mode and policy badges.
|
| 89 |
-
|
| 90 |
-
Returns:
|
| 91 |
-
str: HTML markup for the command input header.
|
| 92 |
-
"""
|
| 93 |
def render_command_header() -> str:
|
| 94 |
return f"""
|
| 95 |
<section class="nw-command-header">
|
|
@@ -101,14 +93,47 @@ def render_command_header() -> str:
|
|
| 101 |
<div class="nw-command-pills">
|
| 102 |
{badge("SFW DEFAULT", "pass")}
|
| 103 |
{badge("ST3GG ALWAYS ON", "cyan")}
|
| 104 |
-
{badge("FLUX.2 PINNED", "accent")}
|
| 105 |
{badge("HUMAN CHECKPOINT", "warn")}
|
| 106 |
</div>
|
| 107 |
</section>
|
| 108 |
"""
|
| 109 |
|
| 110 |
|
| 111 |
-
def
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
"""
|
| 113 |
Renders the application topbar with budget metrics, relay status, and adult mode controls.
|
| 114 |
|
|
@@ -145,6 +170,7 @@ def render_topbar(adult_mode: bool = False, relay_status: dict | None = None) ->
|
|
| 145 |
</div>
|
| 146 |
<div class="nw-locked"><b>18+</b><span>Locked. Enable in Security with explicit justification.</span></div>
|
| 147 |
</div>
|
|
|
|
| 148 |
"""
|
| 149 |
|
| 150 |
|
|
@@ -185,24 +211,8 @@ def render_command_rail(active_section: str = "Forge") -> str:
|
|
| 185 |
"""
|
| 186 |
|
| 187 |
|
| 188 |
-
def render_workflow(run: GenerationRun | None = None) -> str:
|
| 189 |
-
"""
|
| 190 |
-
Render an interactive workflow visualization panel displaying the NEXUS processing pipeline.
|
| 191 |
-
|
| 192 |
-
Derives workflow labels (checkpoint, recommendation, actions, models) from the provided run object
|
| 193 |
-
if available; otherwise displays defaults.
|
| 194 |
-
|
| 195 |
-
Parameters:
|
| 196 |
-
run (GenerationRun | None): Optional generation run providing checkpoint, model stack, and
|
| 197 |
-
inspection data. If None, displays placeholder values.
|
| 198 |
-
|
| 199 |
-
Returns:
|
| 200 |
-
str: HTML section containing a workflow diagram with nodes, edges, legend, and
|
| 201 |
-
operator console.
|
| 202 |
-
"""
|
| 203 |
def render_workflow(run: GenerationRun | None = None, operator_state: dict | None = None) -> str:
|
| 204 |
operator_state = operator_state or {}
|
| 205 |
-
workflow = WorkflowState.default()
|
| 206 |
score = run.checkpoint.trust_score if run else 0.82
|
| 207 |
checkpoint_id = run.checkpoint.checkpoint_id if run else "nw-dry-run"
|
| 208 |
checkpoint_status = str(operator_state.get("checkpoint", "pending_review" if run else "pending"))
|
|
@@ -214,17 +224,14 @@ def render_workflow(run: GenerationRun | None = None, operator_state: dict | Non
|
|
| 214 |
action_label = "Checkpoint approved; export packet may be prepared after ST3GG gate."
|
| 215 |
elif provider_state == "stopped":
|
| 216 |
action_label = "Provider handoff stopped; dry-run evidence remains available."
|
| 217 |
-
recommendation = run.checkpoint.recommendation.replace("_", " ").title() if run else "Awaiting Run"
|
| 218 |
-
required_actions = run.checkpoint.required_actions if run else ["Review candidate thumbnails before promotion"]
|
| 219 |
-
action_label = required_actions[0] if required_actions else "No action pending"
|
| 220 |
model_label = _short_repo(run.model_stack[0].repo_id) if run and run.model_stack else "FLUX.2"
|
| 221 |
locate_label = run.inspection.locate_model.split("/")[-1] if run else "LocateAnything-3B"
|
| 222 |
nodes = {
|
| 223 |
"seed": (35, 52, 190, 210, "Seed Prompt", ["Rogue archivist moving", "through rain-slick neon", "city, couture layers."], "Text-to-Image (FLUX.2)", "complete", "red"),
|
| 224 |
"refine": (275, 52, 185, 160, "Refine", ["Prompt Refiner", "Style Harmonizer", "Negative Purge"], "Qwen2.5-7B", "complete", "violet"),
|
| 225 |
-
"judge": (540, 52, 185, 160, "Judge", ["Aesthetic Scorer", "ST3GG Policy Filter", f"Score {score:.2f}"], "
|
| 226 |
"locate": (785, 52, 185, 160, "Locate", ["Reference Locator", "Pose & Composition", "IP-Adapter"], "Refs 3/5", "complete", "cyan"),
|
| 227 |
-
"generate": (275, 280, 235, 210, "Generate", ["Image / Video Generation", "FLUX.2 + adapter stack", "High-detail couture"], "Steps
|
| 228 |
"video": (590, 280, 235, 210, "Video Path", ["Image to Video", "Frame interpolation", run.video.preset if run else "Wan2.2 / LTX swap"], "Duration 5.6s 24fps", "ready", "blue"),
|
| 229 |
"checkpoint": (880, 285, 185, 185, "Human Checkpoint", ["Human review required", "Verify intent, vibe,", "and output before final."], "Review Now", "paused", "amber"),
|
| 230 |
}
|
|
@@ -307,43 +314,10 @@ def render_workflow(run: GenerationRun | None = None, operator_state: dict | Non
|
|
| 307 |
<span>Judge view keeps product purpose visible without a landing page.</span>
|
| 308 |
</div>
|
| 309 |
</div>
|
| 310 |
-
<div class="nw-weave-console">
|
| 311 |
-
<div class="nw-console-card nw-console-primary">
|
| 312 |
-
<small>Selected Node</small>
|
| 313 |
-
<strong>Human Checkpoint</strong>
|
| 314 |
-
<span>{escape(recommendation)} / {escape(checkpoint_id)}</span>
|
| 315 |
-
</div>
|
| 316 |
-
<div class="nw-console-card">
|
| 317 |
-
<small>Next Operator Action</small>
|
| 318 |
-
<strong>{escape(action_label)}</strong>
|
| 319 |
-
<span>Checkpoint blocks video promotion until reviewed.</span>
|
| 320 |
-
</div>
|
| 321 |
-
<div class="nw-console-card">
|
| 322 |
-
<small>Pinned Model Lanes</small>
|
| 323 |
-
<strong>{escape(model_label)} + {escape(locate_label)} + ST3GG</strong>
|
| 324 |
-
<span>Core lanes stay fixed; helper lanes may rotate.</span>
|
| 325 |
-
</div>
|
| 326 |
-
<div class="nw-console-card">
|
| 327 |
-
<small>Hackathon Signal</small>
|
| 328 |
-
<strong>Workflow, governance, visual creation</strong>
|
| 329 |
-
<span>Judge view keeps product purpose visible without a landing page.</span>
|
| 330 |
-
</div>
|
| 331 |
-
</div>
|
| 332 |
</section>
|
| 333 |
"""
|
| 334 |
|
| 335 |
|
| 336 |
-
def render_artifact_lane(run: GenerationRun | None = None, scan: dict | None = None) -> str:
|
| 337 |
-
"""
|
| 338 |
-
Render the artifact preview lane section with generated artifacts and checkpoint metadata.
|
| 339 |
-
|
| 340 |
-
Parameters:
|
| 341 |
-
run (GenerationRun | None): Current generation run; if None, displays dry-run placeholders.
|
| 342 |
-
scan (dict | None): Scan status including export_gate; defaults to idle/pending if not provided.
|
| 343 |
-
|
| 344 |
-
Returns:
|
| 345 |
-
str: HTML for the artifact preview lane section with preview stage, metadata, and artifact grid.
|
| 346 |
-
"""
|
| 347 |
def render_artifact_lane(run: GenerationRun | None = None, scan: dict | None = None, operator_state: dict | None = None) -> str:
|
| 348 |
scan = scan or {"status": "idle", "export_gate": "pending"}
|
| 349 |
operator_state = operator_state or {}
|
|
@@ -466,7 +440,6 @@ def render_operations_panel(
|
|
| 466 |
("Prompt contract", "Taste-refined prompt, material locks, negative purge, and checkpoint requirements."),
|
| 467 |
("Active run", f"{run_id} / checkpoint remains human-reviewed before video promotion."),
|
| 468 |
("Provider posture", f"{provider_state}: {operator_message}"),
|
| 469 |
-
("Provider posture", "Dry-run packets are visible before paid or gated calls."),
|
| 470 |
],
|
| 471 |
"Wardrobe": [
|
| 472 |
("Slot coverage", f"{outfit_count or 9} garment/accessory regions tracked with locks and edit priority."),
|
|
@@ -495,7 +468,6 @@ def render_operations_panel(
|
|
| 495 |
"Runs": [
|
| 496 |
("Current checkpoint", run_id),
|
| 497 |
("Ledger mode", f"Operator state: {provider_state}. Run JSON, catalog summary, and ST3GG evidence remain in the evidence accordion."),
|
| 498 |
-
("Ledger mode", "Run JSON, catalog summary, and ST3GG evidence remain in the evidence accordion."),
|
| 499 |
("Rollback path", "Feature branches and draft PRs carry implementation checkpoints."),
|
| 500 |
],
|
| 501 |
}
|
|
@@ -572,7 +544,7 @@ def _render_relay_panel(relay_status: dict | None = None) -> str:
|
|
| 572 |
<h3>GMR ModelRelay</h3>
|
| 573 |
<ul class="nw-relay">{rows}</ul>
|
| 574 |
<div class="nw-relay-foot">
|
| 575 |
-
{badge("FLUX.2 pinned", "pass")} {badge("LocateAnything pinned", "pass")} {badge(f"dedup hits {dedup_hits}", "muted")}
|
| 576 |
</div>
|
| 577 |
"""
|
| 578 |
|
|
@@ -618,8 +590,6 @@ def render_provider_cards(relay_status: dict | None = None, adult_mode: bool = F
|
|
| 618 |
<span>{escape(str(provider))} / {escape(str(gate))}</span>
|
| 619 |
<i class="nw-provider-meter" style="--health:{'86' if provider_state in {'configured', 'dry-run'} else '52' if provider_state == 'limited' else '22'}"></i>
|
| 620 |
<div>{badge(provider_state.upper(), tone)}{badge("CHECKPOINTED", "muted")}</div>
|
| 621 |
-
<i class="nw-provider-meter" style="--health:{'86' if status == 'ready' else '52' if status == 'limited' else '22'}"></i>
|
| 622 |
-
<div>{badge(str(status).upper(), tone)}{badge("DRY-RUN", "muted")}</div>
|
| 623 |
</div>
|
| 624 |
"""
|
| 625 |
)
|
|
@@ -678,7 +648,7 @@ def render_inspector(
|
|
| 678 |
scan_status = (scan or {}).get("status", "pass")
|
| 679 |
else:
|
| 680 |
checks = [(label, True) for label in ["Patent Leather", "Faux Fur", "Lace / Mesh", "Crimson Hardware", "Platform Boots", "Layered Garments"]]
|
| 681 |
-
model_rows = "<li><span>active stack</span><strong>FLUX.2 /
|
| 682 |
score = 86
|
| 683 |
scan_status = (scan or {}).get("status", "pass")
|
| 684 |
checks_html = "".join(f'<li><span>{"✓" if ok else "!"}</span>{escape(label)}</li>' for label, ok in checks)
|
|
@@ -835,7 +805,6 @@ def render_dashboard(
|
|
| 835 |
Returns:
|
| 836 |
str: The full HTML dashboard markup.
|
| 837 |
"""
|
| 838 |
-
regions = render_dashboard_regions(run, adult_mode, scan, relay_status, active_section)
|
| 839 |
regions = render_dashboard_regions(run, adult_mode, scan, relay_status, active_section, operator_state)
|
| 840 |
return f"""
|
| 841 |
<div class="nw-app">
|
|
@@ -882,13 +851,11 @@ def render_dashboard_regions(
|
|
| 882 |
dict[str, str]: HTML markup strings keyed by region name (topbar, rail, command_rail, workflow, operations, inspector, drawer, status, artifacts, providers).
|
| 883 |
"""
|
| 884 |
return {
|
| 885 |
-
"topbar": render_topbar(adult_mode, relay_status),
|
| 886 |
"rail": render_left_rail(active_section),
|
| 887 |
"command_rail": render_command_rail(active_section),
|
| 888 |
"workflow": render_workflow(run, operator_state),
|
| 889 |
"operations": render_operations_panel(active_section, run, scan, relay_status, adult_mode=adult_mode, operator_state=operator_state),
|
| 890 |
-
"workflow": render_workflow(run, operator_state),
|
| 891 |
-
"operations": render_operations_panel(active_section, run, scan, relay_status, adult_mode=adult_mode, operator_state=operator_state),
|
| 892 |
"inspector": render_inspector(run, scan, relay_status, operator_state),
|
| 893 |
"drawer": render_drawer(run),
|
| 894 |
"status": render_status_bar(operator_state),
|
|
|
|
| 9 |
|
| 10 |
from .catalog import catalog_summary, parameter_budget
|
| 11 |
from .schema import GenerationRun
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def badge(label: str, tone: str = "neutral") -> str:
|
|
|
|
| 82 |
return f"data:{mime};base64,{data}"
|
| 83 |
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
def render_command_header() -> str:
|
| 86 |
return f"""
|
| 87 |
<section class="nw-command-header">
|
|
|
|
| 93 |
<div class="nw-command-pills">
|
| 94 |
{badge("SFW DEFAULT", "pass")}
|
| 95 |
{badge("ST3GG ALWAYS ON", "cyan")}
|
| 96 |
+
{badge("FLUX.2 4B PINNED", "accent")}
|
| 97 |
{badge("HUMAN CHECKPOINT", "warn")}
|
| 98 |
</div>
|
| 99 |
</section>
|
| 100 |
"""
|
| 101 |
|
| 102 |
|
| 103 |
+
def render_trust_strip(scan: dict | None = None, operator_state: dict | None = None) -> str:
|
| 104 |
+
scan = scan or {"status": "idle", "export_gate": "pending", "findings": [], "purification_actions": []}
|
| 105 |
+
operator_state = operator_state or {}
|
| 106 |
+
status = str(scan.get("status", "idle")).upper()
|
| 107 |
+
export_gate = str(scan.get("export_gate", "pending")).upper()
|
| 108 |
+
checkpoint = str(operator_state.get("checkpoint", "pending")).replace("_", " ").title()
|
| 109 |
+
findings = scan.get("findings") or ["No upload selected. Always-on scanner ready."]
|
| 110 |
+
actions = scan.get("purification_actions") or [
|
| 111 |
+
"strip metadata before export",
|
| 112 |
+
"truncate PNG after IEND when needed",
|
| 113 |
+
"run LSB statistical review",
|
| 114 |
+
]
|
| 115 |
+
tone = _scan_status_tone(str(scan.get("status", "idle")))
|
| 116 |
+
return f"""
|
| 117 |
+
<section class="nw-trust-strip">
|
| 118 |
+
<div class="nw-trust-primary">
|
| 119 |
+
<small>TRUST MODEL</small>
|
| 120 |
+
<strong>Generation is not export.</strong>
|
| 121 |
+
<span>Every artifact must pass ST3GG scan, purification, and human checkpoint before release.</span>
|
| 122 |
+
</div>
|
| 123 |
+
<div class="nw-trust-card">{badge(f"ST3GG {status}", tone)}<span>{escape(str(findings[0]))}</span></div>
|
| 124 |
+
<div class="nw-trust-card">{badge(f"EXPORT {export_gate}", "pass" if export_gate == "CLEAR" else "warn" if export_gate == "BLOCKED" else "muted")}<span>{escape(str(actions[0]))}</span></div>
|
| 125 |
+
<div class="nw-trust-card">{badge(f"CHECKPOINT {checkpoint.upper()}", "pass" if checkpoint == "Approved" else "muted")}<span>Adult Mode never bypasses safety, consent, provenance, or dataset gates.</span></div>
|
| 126 |
+
<div class="nw-trust-card nw-trust-examples">{badge("FIXTURE EVIDENCE", "cyan")}<span>Clean PNG -> pass. PNG trailing bytes -> blocked.</span></div>
|
| 127 |
+
</section>
|
| 128 |
+
"""
|
| 129 |
+
|
| 130 |
+
|
| 131 |
+
def render_topbar(
|
| 132 |
+
adult_mode: bool = False,
|
| 133 |
+
relay_status: dict | None = None,
|
| 134 |
+
scan: dict | None = None,
|
| 135 |
+
operator_state: dict | None = None,
|
| 136 |
+
) -> str:
|
| 137 |
"""
|
| 138 |
Renders the application topbar with budget metrics, relay status, and adult mode controls.
|
| 139 |
|
|
|
|
| 170 |
</div>
|
| 171 |
<div class="nw-locked"><b>18+</b><span>Locked. Enable in Security with explicit justification.</span></div>
|
| 172 |
</div>
|
| 173 |
+
{render_trust_strip(scan, operator_state)}
|
| 174 |
"""
|
| 175 |
|
| 176 |
|
|
|
|
| 211 |
"""
|
| 212 |
|
| 213 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 214 |
def render_workflow(run: GenerationRun | None = None, operator_state: dict | None = None) -> str:
|
| 215 |
operator_state = operator_state or {}
|
|
|
|
| 216 |
score = run.checkpoint.trust_score if run else 0.82
|
| 217 |
checkpoint_id = run.checkpoint.checkpoint_id if run else "nw-dry-run"
|
| 218 |
checkpoint_status = str(operator_state.get("checkpoint", "pending_review" if run else "pending"))
|
|
|
|
| 224 |
action_label = "Checkpoint approved; export packet may be prepared after ST3GG gate."
|
| 225 |
elif provider_state == "stopped":
|
| 226 |
action_label = "Provider handoff stopped; dry-run evidence remains available."
|
|
|
|
|
|
|
|
|
|
| 227 |
model_label = _short_repo(run.model_stack[0].repo_id) if run and run.model_stack else "FLUX.2"
|
| 228 |
locate_label = run.inspection.locate_model.split("/")[-1] if run else "LocateAnything-3B"
|
| 229 |
nodes = {
|
| 230 |
"seed": (35, 52, 190, 210, "Seed Prompt", ["Rogue archivist moving", "through rain-slick neon", "city, couture layers."], "Text-to-Image (FLUX.2)", "complete", "red"),
|
| 231 |
"refine": (275, 52, 185, 160, "Refine", ["Prompt Refiner", "Style Harmonizer", "Negative Purge"], "Qwen2.5-7B", "complete", "violet"),
|
| 232 |
+
"judge": (540, 52, 185, 160, "Judge", ["Aesthetic Scorer", "ST3GG Policy Filter", f"Score {score:.2f}"], "MiniCPM / Nemotron", "complete", "blue"),
|
| 233 |
"locate": (785, 52, 185, 160, "Locate", ["Reference Locator", "Pose & Composition", "IP-Adapter"], "Refs 3/5", "complete", "cyan"),
|
| 234 |
+
"generate": (275, 280, 235, 210, "Generate", ["Image / Video Generation", "FLUX.2 4B + adapter stack", "High-detail couture"], "Steps 4 CFG 1.0", "ready", "green"),
|
| 235 |
"video": (590, 280, 235, 210, "Video Path", ["Image to Video", "Frame interpolation", run.video.preset if run else "Wan2.2 / LTX swap"], "Duration 5.6s 24fps", "ready", "blue"),
|
| 236 |
"checkpoint": (880, 285, 185, 185, "Human Checkpoint", ["Human review required", "Verify intent, vibe,", "and output before final."], "Review Now", "paused", "amber"),
|
| 237 |
}
|
|
|
|
| 314 |
<span>Judge view keeps product purpose visible without a landing page.</span>
|
| 315 |
</div>
|
| 316 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 317 |
</section>
|
| 318 |
"""
|
| 319 |
|
| 320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 321 |
def render_artifact_lane(run: GenerationRun | None = None, scan: dict | None = None, operator_state: dict | None = None) -> str:
|
| 322 |
scan = scan or {"status": "idle", "export_gate": "pending"}
|
| 323 |
operator_state = operator_state or {}
|
|
|
|
| 440 |
("Prompt contract", "Taste-refined prompt, material locks, negative purge, and checkpoint requirements."),
|
| 441 |
("Active run", f"{run_id} / checkpoint remains human-reviewed before video promotion."),
|
| 442 |
("Provider posture", f"{provider_state}: {operator_message}"),
|
|
|
|
| 443 |
],
|
| 444 |
"Wardrobe": [
|
| 445 |
("Slot coverage", f"{outfit_count or 9} garment/accessory regions tracked with locks and edit priority."),
|
|
|
|
| 468 |
"Runs": [
|
| 469 |
("Current checkpoint", run_id),
|
| 470 |
("Ledger mode", f"Operator state: {provider_state}. Run JSON, catalog summary, and ST3GG evidence remain in the evidence accordion."),
|
|
|
|
| 471 |
("Rollback path", "Feature branches and draft PRs carry implementation checkpoints."),
|
| 472 |
],
|
| 473 |
}
|
|
|
|
| 544 |
<h3>GMR ModelRelay</h3>
|
| 545 |
<ul class="nw-relay">{rows}</ul>
|
| 546 |
<div class="nw-relay-foot">
|
| 547 |
+
{badge("FLUX.2 4B pinned", "pass")} {badge("LocateAnything pinned", "pass")} {badge(f"dedup hits {dedup_hits}", "muted")}
|
| 548 |
</div>
|
| 549 |
"""
|
| 550 |
|
|
|
|
| 590 |
<span>{escape(str(provider))} / {escape(str(gate))}</span>
|
| 591 |
<i class="nw-provider-meter" style="--health:{'86' if provider_state in {'configured', 'dry-run'} else '52' if provider_state == 'limited' else '22'}"></i>
|
| 592 |
<div>{badge(provider_state.upper(), tone)}{badge("CHECKPOINTED", "muted")}</div>
|
|
|
|
|
|
|
| 593 |
</div>
|
| 594 |
"""
|
| 595 |
)
|
|
|
|
| 648 |
scan_status = (scan or {}).get("status", "pass")
|
| 649 |
else:
|
| 650 |
checks = [(label, True) for label in ["Patent Leather", "Faux Fur", "Lace / Mesh", "Crimson Hardware", "Platform Boots", "Layered Garments"]]
|
| 651 |
+
model_rows = "<li><span>active stack</span><strong>FLUX.2 4B / MiniCPM / LocateAnything</strong></li>"
|
| 652 |
score = 86
|
| 653 |
scan_status = (scan or {}).get("status", "pass")
|
| 654 |
checks_html = "".join(f'<li><span>{"✓" if ok else "!"}</span>{escape(label)}</li>' for label, ok in checks)
|
|
|
|
| 805 |
Returns:
|
| 806 |
str: The full HTML dashboard markup.
|
| 807 |
"""
|
|
|
|
| 808 |
regions = render_dashboard_regions(run, adult_mode, scan, relay_status, active_section, operator_state)
|
| 809 |
return f"""
|
| 810 |
<div class="nw-app">
|
|
|
|
| 851 |
dict[str, str]: HTML markup strings keyed by region name (topbar, rail, command_rail, workflow, operations, inspector, drawer, status, artifacts, providers).
|
| 852 |
"""
|
| 853 |
return {
|
| 854 |
+
"topbar": render_topbar(adult_mode, relay_status, scan, operator_state),
|
| 855 |
"rail": render_left_rail(active_section),
|
| 856 |
"command_rail": render_command_rail(active_section),
|
| 857 |
"workflow": render_workflow(run, operator_state),
|
| 858 |
"operations": render_operations_panel(active_section, run, scan, relay_status, adult_mode=adult_mode, operator_state=operator_state),
|
|
|
|
|
|
|
| 859 |
"inspector": render_inspector(run, scan, relay_status, operator_state),
|
| 860 |
"drawer": render_drawer(run),
|
| 861 |
"status": render_status_bar(operator_state),
|
src/nexus_visual_weaver/schema.py
CHANGED
|
@@ -71,6 +71,7 @@ class ModelCandidate:
|
|
| 71 |
license: str
|
| 72 |
gated: bool = False
|
| 73 |
adult_only: bool = False
|
|
|
|
| 74 |
source_url: str = ""
|
| 75 |
|
| 76 |
|
|
@@ -150,4 +151,3 @@ class WisdomRecord:
|
|
| 150 |
dataset_target: str
|
| 151 |
lessons: list[str]
|
| 152 |
created_at: str = field(default_factory=utc_now)
|
| 153 |
-
|
|
|
|
| 71 |
license: str
|
| 72 |
gated: bool = False
|
| 73 |
adult_only: bool = False
|
| 74 |
+
public_demo: bool = True
|
| 75 |
source_url: str = ""
|
| 76 |
|
| 77 |
|
|
|
|
| 151 |
dataset_target: str
|
| 152 |
lessons: list[str]
|
| 153 |
created_at: str = field(default_factory=utc_now)
|
|
|
src/nexus_visual_weaver/styles.py
CHANGED
|
@@ -117,6 +117,54 @@ footer { display: none !important; }
|
|
| 117 |
}
|
| 118 |
.nw-locked b { border: 1px solid rgba(255,54,95,.55); border-radius: 5px; padding: 7px 6px; text-align: center; font-size: 13px; }
|
| 119 |
.nw-locked span { font-size: 11px; line-height: 1.25; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 120 |
.nw-icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
| 121 |
.nw-shell {
|
| 122 |
display: grid;
|
|
@@ -889,6 +937,7 @@ footer { display: none !important; }
|
|
| 889 |
}
|
| 890 |
@media (max-width: 1100px) {
|
| 891 |
.nw-topbar { grid-template-columns: 1fr; }
|
|
|
|
| 892 |
.nw-shell { grid-template-columns: 1fr; grid-template-rows: auto; }
|
| 893 |
.nw-rail, .nw-inspector, .nw-bottom { grid-column: 1; grid-row: auto; }
|
| 894 |
.nw-rail { flex-direction: row; overflow-x: auto; }
|
|
|
|
| 117 |
}
|
| 118 |
.nw-locked b { border: 1px solid rgba(255,54,95,.55); border-radius: 5px; padding: 7px 6px; text-align: center; font-size: 13px; }
|
| 119 |
.nw-locked span { font-size: 11px; line-height: 1.25; }
|
| 120 |
+
.nw-trust-strip {
|
| 121 |
+
display: grid;
|
| 122 |
+
grid-template-columns: minmax(260px, 1.2fr) repeat(4, minmax(160px, 1fr));
|
| 123 |
+
gap: 8px;
|
| 124 |
+
padding: 8px;
|
| 125 |
+
border-bottom: 1px solid #171c22;
|
| 126 |
+
background:
|
| 127 |
+
linear-gradient(90deg, rgba(38,215,130,.08), transparent 38%),
|
| 128 |
+
rgba(5, 7, 10, .98);
|
| 129 |
+
}
|
| 130 |
+
.nw-trust-primary,
|
| 131 |
+
.nw-trust-card {
|
| 132 |
+
min-height: 62px;
|
| 133 |
+
border: 1px solid var(--nw-line);
|
| 134 |
+
border-radius: 7px;
|
| 135 |
+
background:
|
| 136 |
+
linear-gradient(135deg, rgba(255,255,255,.04), transparent 42%),
|
| 137 |
+
rgba(255,255,255,.018);
|
| 138 |
+
padding: 9px 11px;
|
| 139 |
+
display: grid;
|
| 140 |
+
align-content: center;
|
| 141 |
+
gap: 4px;
|
| 142 |
+
}
|
| 143 |
+
.nw-trust-primary {
|
| 144 |
+
border-color: rgba(38,215,130,.34);
|
| 145 |
+
background:
|
| 146 |
+
linear-gradient(135deg, rgba(38,215,130,.12), transparent 46%),
|
| 147 |
+
rgba(255,255,255,.02);
|
| 148 |
+
}
|
| 149 |
+
.nw-trust-primary small {
|
| 150 |
+
color: var(--nw-green);
|
| 151 |
+
font-size: 10px;
|
| 152 |
+
font-weight: 800;
|
| 153 |
+
}
|
| 154 |
+
.nw-trust-primary strong {
|
| 155 |
+
color: var(--nw-text);
|
| 156 |
+
font-size: 14px;
|
| 157 |
+
line-height: 1.2;
|
| 158 |
+
}
|
| 159 |
+
.nw-trust-primary span,
|
| 160 |
+
.nw-trust-card span {
|
| 161 |
+
color: var(--nw-muted);
|
| 162 |
+
font-size: 11px;
|
| 163 |
+
line-height: 1.35;
|
| 164 |
+
}
|
| 165 |
+
.nw-trust-card .nw-badge {
|
| 166 |
+
margin-bottom: 1px;
|
| 167 |
+
}
|
| 168 |
.nw-icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
|
| 169 |
.nw-shell {
|
| 170 |
display: grid;
|
|
|
|
| 937 |
}
|
| 938 |
@media (max-width: 1100px) {
|
| 939 |
.nw-topbar { grid-template-columns: 1fr; }
|
| 940 |
+
.nw-trust-strip { grid-template-columns: 1fr; }
|
| 941 |
.nw-shell { grid-template-columns: 1fr; grid-template-rows: auto; }
|
| 942 |
.nw-rail, .nw-inspector, .nw-bottom { grid-column: 1; grid-row: auto; }
|
| 943 |
.nw-rail { flex-direction: row; overflow-x: auto; }
|
tests/fixtures/st3gg_blocked_trailing.png
ADDED
|
tests/fixtures/st3gg_safe_clean.png
ADDED
|
tests/test_command_center.py
CHANGED
|
@@ -47,6 +47,24 @@ def test_active_parameter_budget_passes_default_stack() -> None:
|
|
| 47 |
assert budget["active_b"] <= 32.0
|
| 48 |
|
| 49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
def test_command_center_run_is_checkpointed() -> None:
|
| 51 |
run = build_command_center_run(
|
| 52 |
"Slavic model, patent leather, faux fur, Chantilly lace, crimson hardware, platform boots, NEXUS sigils"
|
|
@@ -54,7 +72,7 @@ def test_command_center_run_is_checkpointed() -> None:
|
|
| 54 |
assert run.checkpoint.checkpoint_id.startswith("nw-")
|
| 55 |
assert run.video.checkpoint_required is True
|
| 56 |
assert run.inspection.targets
|
| 57 |
-
assert
|
| 58 |
|
| 59 |
|
| 60 |
def test_security_scan_does_not_return_payload_excerpt() -> None:
|
|
@@ -77,6 +95,18 @@ def test_security_scan_flags_extension_magic_mismatch() -> None:
|
|
| 77 |
assert any("extension does not match" in finding for finding in scan["findings"])
|
| 78 |
|
| 79 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 80 |
def test_dashboard_regions_expose_artifacts_and_provider_cards() -> None:
|
| 81 |
run = build_command_center_run("gothic couture archivist, patent leather, platform boots")
|
| 82 |
relay = WeaverModelRelay()
|
|
@@ -102,6 +132,8 @@ def test_dashboard_regions_expose_artifacts_and_provider_cards() -> None:
|
|
| 102 |
assert "Provider Handoff Cards" in regions["providers"]
|
| 103 |
assert "nw-provider-meter" in regions["providers"]
|
| 104 |
assert "Selected: Forge" in regions["command_rail"]
|
|
|
|
|
|
|
| 105 |
assert "ST3GG Scan" in regions["inspector"]
|
| 106 |
assert "nw-weave-console" in regions["workflow"]
|
| 107 |
assert "Hackathon Signal" in regions["workflow"]
|
|
@@ -165,7 +197,7 @@ def test_command_header_exposes_governed_run_controls() -> None:
|
|
| 165 |
|
| 166 |
assert "Raven Chronicle Active Weave" in header
|
| 167 |
assert "ST3GG ALWAYS ON" in header
|
| 168 |
-
assert "FLUX.2 PINNED" in header
|
| 169 |
assert "HUMAN CHECKPOINT" in header
|
| 170 |
|
| 171 |
|
|
|
|
| 47 |
assert budget["active_b"] <= 32.0
|
| 48 |
|
| 49 |
|
| 50 |
+
def test_public_stack_uses_flux_4b_and_excludes_private_models() -> None:
|
| 51 |
+
stack = active_stack(False)
|
| 52 |
+
repo_ids = {model.repo_id for model in stack}
|
| 53 |
+
|
| 54 |
+
assert "black-forest-labs/FLUX.2-klein-4B" in repo_ids
|
| 55 |
+
assert "black-forest-labs/FLUX.2-klein-9B" not in repo_ids
|
| 56 |
+
assert not any("OFFELLIA" in repo_id for repo_id in repo_ids)
|
| 57 |
+
assert all(model.params_b <= 4.0 for model in stack)
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def test_private_catalog_keeps_stronger_research_models_available() -> None:
|
| 61 |
+
private_models, _ = filter_catalog(True)
|
| 62 |
+
repo_ids = {model.repo_id for model in private_models}
|
| 63 |
+
|
| 64 |
+
assert "black-forest-labs/FLUX.2-klein-9B" in repo_ids
|
| 65 |
+
assert "Brunobkr/OFFELLIA_Q4_0_gemma-4-12B-it.gguf" in repo_ids
|
| 66 |
+
|
| 67 |
+
|
| 68 |
def test_command_center_run_is_checkpointed() -> None:
|
| 69 |
run = build_command_center_run(
|
| 70 |
"Slavic model, patent leather, faux fur, Chantilly lace, crimson hardware, platform boots, NEXUS sigils"
|
|
|
|
| 72 |
assert run.checkpoint.checkpoint_id.startswith("nw-")
|
| 73 |
assert run.video.checkpoint_required is True
|
| 74 |
assert run.inspection.targets
|
| 75 |
+
assert any(model.repo_id == "nvidia/LocateAnything-3B" for model in run.model_stack)
|
| 76 |
|
| 77 |
|
| 78 |
def test_security_scan_does_not_return_payload_excerpt() -> None:
|
|
|
|
| 95 |
assert any("extension does not match" in finding for finding in scan["findings"])
|
| 96 |
|
| 97 |
|
| 98 |
+
def test_security_scan_safe_vs_blocked_fixtures() -> None:
|
| 99 |
+
fixture_dir = Path(__file__).parent / "fixtures"
|
| 100 |
+
safe = scan_file(str(fixture_dir / "st3gg_safe_clean.png"))
|
| 101 |
+
blocked = scan_file(str(fixture_dir / "st3gg_blocked_trailing.png"))
|
| 102 |
+
|
| 103 |
+
assert safe["status"] == "pass"
|
| 104 |
+
assert safe["export_gate"] == "clear"
|
| 105 |
+
assert blocked["status"] == "review"
|
| 106 |
+
assert blocked["export_gate"] == "blocked"
|
| 107 |
+
assert any("trailing data" in finding for finding in blocked["findings"])
|
| 108 |
+
|
| 109 |
+
|
| 110 |
def test_dashboard_regions_expose_artifacts_and_provider_cards() -> None:
|
| 111 |
run = build_command_center_run("gothic couture archivist, patent leather, platform boots")
|
| 112 |
relay = WeaverModelRelay()
|
|
|
|
| 132 |
assert "Provider Handoff Cards" in regions["providers"]
|
| 133 |
assert "nw-provider-meter" in regions["providers"]
|
| 134 |
assert "Selected: Forge" in regions["command_rail"]
|
| 135 |
+
assert "TRUST MODEL" in regions["topbar"]
|
| 136 |
+
assert "Clean PNG -> pass" in regions["topbar"]
|
| 137 |
assert "ST3GG Scan" in regions["inspector"]
|
| 138 |
assert "nw-weave-console" in regions["workflow"]
|
| 139 |
assert "Hackathon Signal" in regions["workflow"]
|
|
|
|
| 197 |
|
| 198 |
assert "Raven Chronicle Active Weave" in header
|
| 199 |
assert "ST3GG ALWAYS ON" in header
|
| 200 |
+
assert "FLUX.2 4B PINNED" in header
|
| 201 |
assert "HUMAN CHECKPOINT" in header
|
| 202 |
|
| 203 |
|
tests/test_hf_runtime.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
from PIL import Image
|
| 2 |
|
| 3 |
-
from nexus_visual_weaver.hf_runtime import generate_flux_image, hf_runtime_enabled
|
| 4 |
from nexus_visual_weaver.render import render_artifact_lane
|
| 5 |
|
| 6 |
|
|
@@ -14,6 +14,12 @@ def test_hf_runtime_is_disabled_locally_by_default(monkeypatch) -> None:
|
|
| 14 |
result = generate_flux_image("test prompt")
|
| 15 |
assert result.status == "disabled"
|
| 16 |
assert result.provider_state == "dry-run"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
|
| 19 |
def test_artifact_lane_embeds_generated_image() -> None:
|
|
|
|
| 1 |
from PIL import Image
|
| 2 |
|
| 3 |
+
from nexus_visual_weaver.hf_runtime import FLUX_REPO_ID, PRIVATE_RESEARCH_FLUX_REPO_ID, generate_flux_image, hf_runtime_enabled
|
| 4 |
from nexus_visual_weaver.render import render_artifact_lane
|
| 5 |
|
| 6 |
|
|
|
|
| 14 |
result = generate_flux_image("test prompt")
|
| 15 |
assert result.status == "disabled"
|
| 16 |
assert result.provider_state == "dry-run"
|
| 17 |
+
assert result.repo_id == "black-forest-labs/FLUX.2-klein-4B"
|
| 18 |
+
|
| 19 |
+
|
| 20 |
+
def test_public_and_private_flux_repo_ids_are_split() -> None:
|
| 21 |
+
assert FLUX_REPO_ID == "black-forest-labs/FLUX.2-klein-4B"
|
| 22 |
+
assert PRIVATE_RESEARCH_FLUX_REPO_ID == "black-forest-labs/FLUX.2-klein-9B"
|
| 23 |
|
| 24 |
|
| 25 |
def test_artifact_lane_embeds_generated_image() -> None:
|
tests/test_model_relay.py
CHANGED
|
@@ -11,11 +11,21 @@ def test_pinned_lanes_do_not_rotate() -> None:
|
|
| 11 |
assert decision.pinned is True
|
| 12 |
assert decision.rotatable is False
|
| 13 |
assert decision.primary is not None
|
| 14 |
-
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-
|
|
|
|
| 15 |
assert decision.fallbacks == []
|
| 16 |
assert "rotation disabled" in decision.reason
|
| 17 |
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
def test_public_private_taste_judge_respects_license_and_budget() -> None:
|
| 20 |
relay = WeaverModelRelay()
|
| 21 |
|
|
@@ -65,8 +75,8 @@ def test_metadata_dedup_prevents_repeated_hf_lookup() -> None:
|
|
| 65 |
calls["count"] += 1
|
| 66 |
return {"calls": calls["count"]}
|
| 67 |
|
| 68 |
-
first = relay.metadata_lookup("hf:black-forest-labs/FLUX.2-klein-
|
| 69 |
-
second = relay.metadata_lookup("hf:black-forest-labs/FLUX.2-klein-
|
| 70 |
|
| 71 |
assert first == second == {"calls": 1}
|
| 72 |
assert calls["count"] == 1
|
|
@@ -113,7 +123,7 @@ def test_dashboard_surfaces_gmr_pinned_models_and_fallbacks() -> None:
|
|
| 113 |
html = render_dashboard(relay_status=relay.dashboard_snapshot(public_demo=True))
|
| 114 |
|
| 115 |
assert "GMR ModelRelay" in html
|
| 116 |
-
assert "FLUX.2 pinned" in html
|
| 117 |
assert "LocateAnything pinned" in html
|
| 118 |
assert "fallback:" in html
|
| 119 |
assert "Rotation Safe" in html
|
|
|
|
| 11 |
assert decision.pinned is True
|
| 12 |
assert decision.rotatable is False
|
| 13 |
assert decision.primary is not None
|
| 14 |
+
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-4B"
|
| 15 |
+
assert decision.primary.params_b == 4.0
|
| 16 |
assert decision.fallbacks == []
|
| 17 |
assert "rotation disabled" in decision.reason
|
| 18 |
|
| 19 |
|
| 20 |
+
def test_private_image_research_keeps_flux_9b_available() -> None:
|
| 21 |
+
relay = WeaverModelRelay()
|
| 22 |
+
decision = relay.select_lane("private_image_research", budget=9.0, public_demo=False, strategy="private_research")
|
| 23 |
+
|
| 24 |
+
assert decision.primary is not None
|
| 25 |
+
assert decision.primary.repo_id == "black-forest-labs/FLUX.2-klein-9B"
|
| 26 |
+
assert decision.primary.pinned is False
|
| 27 |
+
|
| 28 |
+
|
| 29 |
def test_public_private_taste_judge_respects_license_and_budget() -> None:
|
| 30 |
relay = WeaverModelRelay()
|
| 31 |
|
|
|
|
| 75 |
calls["count"] += 1
|
| 76 |
return {"calls": calls["count"]}
|
| 77 |
|
| 78 |
+
first = relay.metadata_lookup("hf:black-forest-labs/FLUX.2-klein-4B", resolver)
|
| 79 |
+
second = relay.metadata_lookup("hf:black-forest-labs/FLUX.2-klein-4B", resolver)
|
| 80 |
|
| 81 |
assert first == second == {"calls": 1}
|
| 82 |
assert calls["count"] == 1
|
|
|
|
| 123 |
html = render_dashboard(relay_status=relay.dashboard_snapshot(public_demo=True))
|
| 124 |
|
| 125 |
assert "GMR ModelRelay" in html
|
| 126 |
+
assert "FLUX.2 4B pinned" in html
|
| 127 |
assert "LocateAnything pinned" in html
|
| 128 |
assert "fallback:" in html
|
| 129 |
assert "Rotation Safe" in html
|