Skip to content

feat(cli): add provider capacity command - #147

Open
codeaholicguy wants to merge 18 commits into
mainfrom
feature-capacity-cmd
Open

feat(cli): add provider capacity command#147
codeaholicguy wants to merge 18 commits into
mainfrom
feature-capacity-cmd

Conversation

@codeaholicguy

@codeaholicguy codeaholicguy commented Aug 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • simplify ai-devkit capacity to support Codex only
  • remove the normalized cache, --max-age, --refresh, and all cache reads/writes so every invocation probes fresh
  • remove Claude, Pi, GLM, unsupported-provider adapters, generic provider detection, and multi-provider orchestration
  • move Codex probing, normalization, detection, and schema-v1 capacity types into @ai-devkit/agent-manager
  • keep the CLI as a thin layer for command registration, Codex argument validation, report retrieval, and text/JSON rendering

Codex probe

  • resolve CODEX_HOME/auth.json or ~/.codex/auth.json
  • prefer PAT whoami plus usage, then fresh OAuth usage, then the hardened CLI fallback
  • run the fallback as codex -s read-only -a untrusted app-server and call only account/rateLimits/read and account/read
  • preserve normalized arbitrary windows, usage source, authentication, availability, plan, reset-credit, warning, and stable error fields
  • never refresh credentials, invoke a model turn, redeem reset credits, or expose tokens/raw provider failures

Package boundary

  • packages/agent-manager/src/capacity/ owns the capacity model and fresh Codex report API
  • agent-manager exports getCodexCapacityReport and public capacity types from its root entry point
  • packages/cli/src/commands/capacity.ts validates only omitted provider or codex, calls agent-manager, and renders the result
  • lifecycle docs record each simplification opportunity and the acted/rejected decision

Validation

After rebasing onto current origin/main:

  • npm run build — passed for all 6 projects
  • npm test --workspace=@ai-devkit/agent-manager — 28 files, 571 tests passed
  • npm test --workspace=ai-devkit — 85 files, 1,033 tests passed
  • commit hooks: repository lint passed with pre-existing warnings only; repository-wide tests passed before rebase

Risks

  • schema v1 and the tiered Codex fallback are retained, limiting compatibility risk
  • non-Codex capacity rows and cache-related CLI options are intentionally removed

The schemaVersion field in the JSON output is the machine-checked contract marker; help text and README now describe the flag's behavior without leaking the contract version. Lifecycle docs updated to match; the design doc's rejected-alternative table keeps its wording because it records the decision itself.
Use '-j, --json' with 'Output as JSON' like every agent subcommand; drop remaining schema mentions from README and lifecycle docs. The schemaVersion field stays in the JSON output itself.
Replace the hand-rolled table with ui.table (widths, truncation, maxWidth, bold headers, separator) and chalk column styles matching agent list: cyan provider, green/yellow/gray availability, dim metadata. JSON output goes through console.log and warnings through ui.warning like agent list.
Help text and README no longer hard-code Codex or the model-quota rationale; the supported provider list is enforced in code.
Drop schemaVersion, the providers array, status/configured/installed/agentType/plan/checkedAt/source, aliases, the resetCredits wrapper, the embedded usage snapshot, warnings, and error codes: none had a current consumer and all predate the codex-only cut. The report is now one flat object: provider, generatedAt, authenticated, available, native windows (id, label, durationMinutes, usedPercent, resetsAt), and creditsRemaining. remainingPercent and alias derivation are left to consumers; configured-detection is removed with the field it fed. Verified against a live Codex probe; fields can return with a second provider.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant