P3.5-P3.7: 2-layer inventory, capability routing, STT/TTS adapters, Dev Contract

NCS:
- _collect_worker_caps() fetches capability flags from node-worker /caps
- _derive_capabilities() merges served model types + worker provider flags
- installed_artifacts replaces inventory_only (disk scan with DISK_SCAN_PATHS env)
- New endpoints: /capabilities/caps, /capabilities/installed

Node Worker:
- STT_PROVIDER, TTS_PROVIDER, OCR_PROVIDER, IMAGE_PROVIDER env flags
- /caps endpoint returns capabilities + providers for NCS aggregation
- STT adapter (providers/stt_mlx_whisper.py) — remote + local mode
- TTS adapter (providers/tts_mlx_kokoro.py) — remote + local mode
- OCR handler via vision_prompted (ollama_vision with OCR prompt)
- NATS subjects: node.{id}.stt/tts/ocr/image.request

Router:
- POST /v1/capability/{stt,tts,ocr,image} — capability-based offload routing
- GET /v1/capabilities — global view with capabilities_by_node
- require_fresh_caps(ttl) preflight guard
- find_nodes_with_capability(cap) + load-based node selection

Ops:
- ops/fabric_snapshot.py — full runtime snapshot collector
- ops/fabric_preflight.sh — quick check + snapshot save + diff
- docs/fabric_contract.md — Dev Contract v0.1 (preflight-first)
- tests/test_fabric_contract.py — CI enforcement (6 tests)

Made-with: Cursor
This commit is contained in:
Apple
2026-02-27 05:24:09 -08:00
parent 194c87f53c
commit 9a36020316
17 changed files with 1352 additions and 21 deletions

View File

@@ -120,6 +120,9 @@ services:
- "127.0.0.1:8099:8099"
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
- ~/.ollama/models:/host_models/ollama:ro
- ~/.cache/huggingface/hub:/host_models/hf_cache:ro
environment:
- NODE_ID=NODA2
- OLLAMA_BASE_URL=http://host.docker.internal:11434
@@ -129,6 +132,7 @@ services:
- ENABLE_NATS_CAPS=true
- NATS_URL=nats://dagi-nats:4222
- NODE_WORKER_URL=http://node-worker:8109
- DISK_SCAN_PATHS=/host_models/ollama,/host_models/hf_cache
depends_on:
- swapper-service
- dagi-nats
@@ -153,6 +157,11 @@ services:
- NODE_DEFAULT_VISION=llava:13b
- NODE_WORKER_MAX_CONCURRENCY=2
- NCS_REPORT_URL=http://node-capabilities:8099
# Capability providers (none = not available on this node)
- STT_PROVIDER=none
- TTS_PROVIDER=none
- OCR_PROVIDER=vision_prompted
- IMAGE_PROVIDER=none
depends_on:
- dagi-nats
networks: