refactor(packages): extract model-core package
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
Task 3 ProviderCache interface evidence
|
||||
|
||||
Defined interface:
|
||||
|
||||
- `packages/model-core/src/provider-cache.ts`
|
||||
- `readConnectedProvidersCache(): string[] | null`
|
||||
- `findProviderModelMetadata(providerID: string, modelID: string): ModelMetadata | undefined`
|
||||
|
||||
Injection points:
|
||||
|
||||
- `packages/model-core/src/model-resolution-pipeline.ts`
|
||||
- `resolveModelPipeline(request, providerCache)` uses `providerCache.readConnectedProvidersCache()`.
|
||||
- `packages/model-core/src/model-error-classifier.ts`
|
||||
- `selectFallbackProviderWithCache(providers, providerCache, preferredProviderID?)` uses `providerCache.readConnectedProvidersCache()`.
|
||||
|
||||
Adapter wiring in OMO:
|
||||
|
||||
- `src/shared/model-resolution-pipeline.ts` passes `connectedProvidersCache` into model-core resolver.
|
||||
- `src/shared/model-error-classifier.ts` passes `connectedProvidersCache` into model-core provider selection.
|
||||
@@ -0,0 +1,8 @@
|
||||
Task 3 no-coupling evidence
|
||||
|
||||
- Extracted model resolution files into `packages/model-core/src` and replaced original `src/shared/*` with per-file shims.
|
||||
- `packages/model-core/src/model-resolution-pipeline.ts` now accepts `providerCache: ProviderCache` and no longer imports `src/shared/connected-providers-cache` directly.
|
||||
- `packages/model-core/src/model-error-classifier.ts` exposes `selectFallbackProviderWithCache(...)` and supports cache injection.
|
||||
- OMO call-sites receive cache injection through shared adapters:
|
||||
- `src/shared/model-resolution-pipeline.ts` injects `src/shared/connected-providers-cache` into model-core.
|
||||
- `src/shared/model-error-classifier.ts` injects `src/shared/connected-providers-cache` into model-core.
|
||||
@@ -0,0 +1,8 @@
|
||||
Task 3 verification evidence
|
||||
|
||||
- `bun run typecheck` => exit 0
|
||||
- `bun test` => `7312 pass / 1 skip / 2 fail / 7315 total` (matches baseline)
|
||||
- `bun run build` => exit 0
|
||||
|
||||
Notes:
|
||||
- The 2 failures are pre-existing baseline failures in `src/features/opencode-skill-loader/skill-content.test.ts`.
|
||||
@@ -53,3 +53,13 @@
|
||||
- `bun run typecheck` exit 0
|
||||
- `bun test` 7312/1/2/7315 (baseline-matching drift)
|
||||
- `bun run build` exit 0
|
||||
|
||||
## [2026-05-21T00:00:00Z] Task 3 retry (worktree)
|
||||
- Extracted model resolution pipeline surface into `packages/model-core/` with moved sources/tests and package scaffold (`package.json`, `tsconfig.json`, barrel `src/index.ts`).
|
||||
- Added ProviderCache DI seam in model-core:
|
||||
- `model-resolution-pipeline.ts` accepts `providerCache`.
|
||||
- `model-error-classifier.ts` exposes cache-injected provider selector.
|
||||
- Kept OMO runtime cache implementation in `src/shared/connected-providers-cache.ts` and wired injections through shared shims.
|
||||
- Recreated per-file `src/shared` shims with explicit symbol re-exports (no `export *` in shims).
|
||||
- Moved `src/shared/model-capabilities/` subtree into model-core and kept shared adapter entry via `src/shared/model-capabilities/index.ts` wrapper.
|
||||
- Verification pass: `bun run typecheck`=0, `bun test`=7312/1/2/7315 baseline, `bun run build`=0.
|
||||
|
||||
Reference in New Issue
Block a user