M1: Add unified capacity status command #21

Merged
creatidy merged 2 commits from m1-unified-status into main 2026-09-05 11:39:04 +00:00
creatidy commented 2026-09-05 10:03:33 +00:00 (Migrated from github.com)

Closes #20

Invocation

Use the provisional development surface:

uv run python -m scarcity_router status
uv run python -m scarcity_router status --json

The final package and executable name remain unresolved under U-008.

Ollama configuration

  • SCARCITY_ROUTER_OLLAMA_MODEL or --ollama-model is required.
  • CLI values override environment values.
  • Optional endpoint and configured-context values are available through the corresponding CLI options or SCARCITY_ROUTER_OLLAMA_ENDPOINT and SCARCITY_ROUTER_OLLAMA_CONTEXT_TOKENS.
  • Endpoint validation remains restricted to numeric-loopback HTTP targets.

Behavior

  • Collects OpenAI/Codex, Z.ai Coding Plan, and Ollama in deterministic openai, zai, ollama order.
  • Establishes one canonical UTC millisecond observation timestamp and passes it to all three collectors.
  • Uses existing normalized CapacitySnapshot results; provider-specific payload parsing remains at provider edges.
  • Keeps normalized operational failures isolated so one degraded provider does not suppress the others.
  • Human output shows provider/status/plan, deterministic quota windows, percentages, reset times, Ollama runtime/model/context facts, and safe diagnostics.
  • --json emits an ordered JSON array of the existing CapacitySnapshot.to_dict() values, with no competing schema.
  • Provider health states return exit 0; missing or invalid Ollama configuration returns 2; internal/contract failures remain non-zero.
  • Status is read-only and issues no model request.

Verification

  • Focused status tests: 14 in tests/test_status.py.
  • Full test suite: 469 tests passed.
  • make check: passed.
  • basedpyright: 0 errors, 0 warnings, 0 notes.
  • CLI and status help commands pass.

Documentation and M1 state

  • README documents prerequisites, configuration, human output, JSON output, and read-only/exit behavior.
  • Provider documentation now records status composition as implemented.
  • Roadmap records all three collectors and unified status as implemented, documents the narrow synchronous U-003 result, and defers separate doctor unless real use exposes a gap.
  • Exact remaining M1 gaps are owner workflow acceptance against the supported local environment and the final residual/evidence audit.
  • Roadmap remains explicitly M1 STATUS: NOT YET PASS.

No M2 selector, peak-hours, banked-reset selection, provider-health feed, external status page, Artificial Analysis, ollama-monitoring, REST, MCP, cache, or model execution work was started. No external status page was called and no Artificial Analysis key was stored or used.

Closes #20 ## Invocation Use the provisional development surface: ```bash uv run python -m scarcity_router status uv run python -m scarcity_router status --json ``` The final package and executable name remain unresolved under U-008. ## Ollama configuration - `SCARCITY_ROUTER_OLLAMA_MODEL` or `--ollama-model` is required. - CLI values override environment values. - Optional endpoint and configured-context values are available through the corresponding CLI options or `SCARCITY_ROUTER_OLLAMA_ENDPOINT` and `SCARCITY_ROUTER_OLLAMA_CONTEXT_TOKENS`. - Endpoint validation remains restricted to numeric-loopback HTTP targets. ## Behavior - Collects OpenAI/Codex, Z.ai Coding Plan, and Ollama in deterministic `openai`, `zai`, `ollama` order. - Establishes one canonical UTC millisecond observation timestamp and passes it to all three collectors. - Uses existing normalized `CapacitySnapshot` results; provider-specific payload parsing remains at provider edges. - Keeps normalized operational failures isolated so one degraded provider does not suppress the others. - Human output shows provider/status/plan, deterministic quota windows, percentages, reset times, Ollama runtime/model/context facts, and safe diagnostics. - `--json` emits an ordered JSON array of the existing `CapacitySnapshot.to_dict()` values, with no competing schema. - Provider health states return exit 0; missing or invalid Ollama configuration returns 2; internal/contract failures remain non-zero. - Status is read-only and issues no model request. ## Verification - Focused status tests: 14 in `tests/test_status.py`. - Full test suite: 469 tests passed. - `make check`: passed. - `basedpyright`: 0 errors, 0 warnings, 0 notes. - CLI and status help commands pass. ## Documentation and M1 state - README documents prerequisites, configuration, human output, JSON output, and read-only/exit behavior. - Provider documentation now records status composition as implemented. - Roadmap records all three collectors and unified status as implemented, documents the narrow synchronous U-003 result, and defers separate `doctor` unless real use exposes a gap. - Exact remaining M1 gaps are owner workflow acceptance against the supported local environment and the final residual/evidence audit. - Roadmap remains explicitly `M1 STATUS: NOT YET PASS`. No M2 selector, peak-hours, banked-reset selection, provider-health feed, external status page, Artificial Analysis, ollama-monitoring, REST, MCP, cache, or model execution work was started. No external status page was called and no Artificial Analysis key was stored or used.
Sign in to join this conversation.
No description provided.