9 Commits

Author SHA1 Message Date
YeonGyu-Kim 767f5a6148 fix(model-core): retry OpenAI usage_limit_reached fallbacks
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-25 17:09:52 +09:00
YeonGyu-Kim 87de056308 refactor(model-core): move model family detectors
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-24 17:16:40 +09:00
YeonGyu-Kim 9c9e9885fe fix(model-core): restore OpenAI server_error retryable patterns (regression from package extraction)
c85d2f9bc added 'server_error' and 'an error occurred while processing'
to the retryable message patterns to fix #3799 - the OpenAI streaming
server_error case where runtime fallback never fired. The package
layering refactor (2748009ff) moved model-error-classifier into
packages/model-core but dropped these two patterns during the move.

Restore both patterns at the matching position. packages/model-core
tests now pass on the server_error retryable assertion, and runtime
fallback once again retries the OpenAI streaming server_error envelope.
2026-05-22 00:07:46 +09:00
YeonGyu-Kim edaa95fec0 refactor(model-core): host snapshot fetcher, suggestion parser, and context-limit resolver
Move three pure helpers from src/shared/ into @oh-my-opencode/model-core so the package can stand alone without depending on plugin internals:

- buildModelCapabilitiesSnapshotFromModelsDev + fetchModelCapabilitiesSnapshot (models.dev normalization)
- parseModelSuggestion (cross-provider ProviderModelNotFoundError suggestion extraction)
- resolveActualContextLimit (Anthropic GA 1M context override)

Split provider-model-id-transform into two variants exposed by model-core:

- transformModelForProvider keeps the runtime dash to dot Anthropic rewrite used by the SDK
- transformModelForProviderDisplay preserves hyphenated Anthropic IDs so the installer writes registry-compatible model strings, fixing the ProviderModelNotFoundError fresh installs hit when the dotted form leaks into the config

src/shared/* and src/cli/provider-model-id-transform.ts collapse to re-export shims that point at the new core modules. Stale src/shared/{known-variants,model-capability-aliases,model-capability-guardrails,model-capability-heuristics}.ts re-export files plus the duplicated context-limit-resolver test are removed in favor of the canonical model-core copies.

Tests: bun test packages/model-core src/shared/model-capabilities-cache.test.ts src/cli/provider-model-id-transform.test.ts
2026-05-21 16:19:38 +09:00
YeonGyu-Kim fc0f4cc9ee chore(model-core): remove unused generated snapshot (DI strategy makes it dead) 2026-05-21 12:50:10 +09:00
YeonGyu-Kim 017f05dddb refactor(packages/model-core): eliminate src/ back-imports via dependency injection 2026-05-21 12:50:10 +09:00
YeonGyu-Kim e15461febc refactor(model-core): inject bundled capabilities snapshot from harness
- remove bundled snapshot dependency on src/generated in model-core

- make shared harness provide runtime bundled snapshot

- update guardrail and capability tests to pass explicit snapshot

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-21 12:50:10 +09:00
YeonGyu-Kim 2462d7af29 refactor(model-core): remove src back-imports via core utilities and adapter
- move fuzzyMatchModel and transformModelForProvider into model-core

- replace connected-providers re-export with adapter contract

- route shared wrappers through model-core exports

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-21 12:50:10 +09:00
YeonGyu-Kim 2748009ff2 refactor(packages): extract model-core package 2026-05-21 12:49:50 +09:00