|
| 1 | +# PLAN |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Capture the completed session work for the `--model free` / `--variant any` feature in one repository-root summary file. |
| 6 | + |
| 7 | +## User Spec |
| 8 | + |
| 9 | +- Support `opencode --model free` instead of introducing a separate `--free` flag. |
| 10 | +- Make `--model free` / `-m free` resolve to a random built-in free Opencode Zen model only. |
| 11 | +- Narrow the implementation to valid runtime `opencode` provider free listings after earlier broader zero-cost model selection proved unreliable. |
| 12 | +- Support `--model free --variant any` so the chosen free model also gets a random supported variant/effort level. |
| 13 | +- Preserve explicit variant values unchanged. |
| 14 | +- If the chosen free model has no variants, treat `any` as the default/no-variant path. |
| 15 | + |
| 16 | +## What Was Implemented |
| 17 | + |
| 18 | +- Added `free` model handling through provider/model resolution instead of a dedicated CLI flag. |
| 19 | +- Limited free-model randomization to built-in `opencode` provider free listings, excluding OpenRouter free models. |
| 20 | +- Added `any` variant handling so free-model selection can also randomize across supported runtime variants. |
| 21 | +- Kept explicit variants passing through unchanged. |
| 22 | +- Added fallback behavior when a selected free model exposes no variants. |
| 23 | +- Updated the LSP test so it no longer depends on installing `typescript-language-server` during test execution, clearing a pre-existing blocker. |
| 24 | + |
| 25 | +## Key Files |
| 26 | + |
| 27 | +- `packages/opencode/src/provider/provider.ts` |
| 28 | +- `packages/opencode/src/cli/cmd/run.ts` |
| 29 | +- `packages/opencode/src/cli/cmd/tui/thread.ts` |
| 30 | +- `packages/opencode/src/cli/cmd/tui/app.tsx` |
| 31 | +- `packages/opencode/src/cli/cmd/tui/context/args.tsx` |
| 32 | +- `packages/opencode/test/provider/provider.test.ts` |
| 33 | +- `packages/opencode/test/cli/cmd/run.test.ts` |
| 34 | +- `packages/opencode/test/cli/tui/thread.test.ts` |
| 35 | +- `packages/opencode/test/lsp/index.test.ts` |
| 36 | + |
| 37 | +## Validation |
| 38 | + |
| 39 | +- `cd /Users/rohit/Documents/opencode/packages/opencode && bun run typecheck` — passed |
| 40 | +- `cd /Users/rohit/Documents/opencode/packages/opencode && bun run lint` — passed |
| 41 | + |
| 42 | +## Known Decisions |
| 43 | + |
| 44 | +- `free` is now a model selector semantic, not a separate flag. |
| 45 | +- The valid free-model pool is the runtime Opencode Zen built-in listings only. |
| 46 | +- OpenRouter free models are intentionally out of scope for this behavior. |
| 47 | +- `any` only randomizes among variants actually supported by the selected free model. |
| 48 | + |
| 49 | +## Follow-ups |
| 50 | + |
| 51 | +- Keep future free-model changes aligned with the built-in `opencode` provider runtime listings. |
| 52 | +- If the free-model catalog changes, update provider selection logic and affected tests together. |
| 53 | + |
| 54 | +## Fixed |
| 55 | + |
| 56 | +- Removed the unused `const ANY = "any"` constant that was causing the `ANY` reference in `resolveSelection` to be undefined. |
| 57 | +- Made `ANY` an exported const so it can be used by callers if needed. |
| 58 | +- The variant handling for "any" now works correctly — calling `opencode --model free --variant any` will randomly select both a free model AND a variant from that model. |
0 commit comments