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>
This commit is contained in:
@@ -1,15 +1,25 @@
|
||||
import {
|
||||
getBundledModelCapabilitiesSnapshot,
|
||||
getModelCapabilities as getModelCapabilitiesFromCore,
|
||||
getBundledModelCapabilitiesSnapshot,
|
||||
getModelCapabilities as getModelCapabilitiesFromCore,
|
||||
} from "@oh-my-opencode/model-core"
|
||||
import type { GetModelCapabilitiesInput, ModelCapabilities } from "@oh-my-opencode/model-core"
|
||||
import * as connectedProvidersCache from "../connected-providers-cache"
|
||||
import bundledModelCapabilitiesSnapshotJson from "../../generated/model-capabilities.generated.json"
|
||||
|
||||
export { getBundledModelCapabilitiesSnapshot }
|
||||
export function getBundledModelCapabilitiesSnapshotForRuntime() {
|
||||
return getBundledModelCapabilitiesSnapshot(bundledModelCapabilitiesSnapshotJson)
|
||||
}
|
||||
|
||||
export function getBundledModelCapabilitiesSnapshotForShared(): ReturnType<typeof getBundledModelCapabilitiesSnapshotForRuntime> {
|
||||
return getBundledModelCapabilitiesSnapshotForRuntime()
|
||||
}
|
||||
|
||||
export { getBundledModelCapabilitiesSnapshotForShared as getBundledModelCapabilitiesSnapshot }
|
||||
|
||||
export function getModelCapabilities(input: GetModelCapabilitiesInput): ModelCapabilities {
|
||||
return getModelCapabilitiesFromCore({
|
||||
...input,
|
||||
bundledSnapshot: input.bundledSnapshot ?? getBundledModelCapabilitiesSnapshotForRuntime(),
|
||||
providerCache: input.providerCache ?? connectedProvidersCache,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user