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,24 +1,14 @@
|
||||
import bundledModelCapabilitiesSnapshotJson from "../../../../src/generated/model-capabilities.generated.json"
|
||||
|
||||
import { SUPPLEMENTAL_MODEL_CAPABILITIES } from "./supplemental-entries"
|
||||
import type { ModelCapabilitiesSnapshot } from "./types"
|
||||
|
||||
function normalizeSnapshot(
|
||||
snapshot: ModelCapabilitiesSnapshot | typeof bundledModelCapabilitiesSnapshotJson,
|
||||
export function getBundledModelCapabilitiesSnapshot(
|
||||
snapshotJson: ModelCapabilitiesSnapshot,
|
||||
): ModelCapabilitiesSnapshot {
|
||||
return snapshot as ModelCapabilitiesSnapshot
|
||||
}
|
||||
|
||||
const normalizedBundledSnapshot = normalizeSnapshot(bundledModelCapabilitiesSnapshotJson)
|
||||
|
||||
const bundledModelCapabilitiesSnapshot: ModelCapabilitiesSnapshot = {
|
||||
...normalizedBundledSnapshot,
|
||||
models: {
|
||||
...normalizedBundledSnapshot.models,
|
||||
...SUPPLEMENTAL_MODEL_CAPABILITIES,
|
||||
},
|
||||
}
|
||||
|
||||
export function getBundledModelCapabilitiesSnapshot(): ModelCapabilitiesSnapshot {
|
||||
return bundledModelCapabilitiesSnapshot
|
||||
return {
|
||||
...snapshotJson,
|
||||
models: {
|
||||
...snapshotJson.models,
|
||||
...SUPPLEMENTAL_MODEL_CAPABILITIES,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import { resolveModelIDAlias } from "../model-capability-aliases"
|
||||
import { detectHeuristicModelFamily } from "../model-capability-heuristics"
|
||||
import type { ProviderCache } from "../provider-cache"
|
||||
|
||||
import { getBundledModelCapabilitiesSnapshot } from "./bundled-snapshot"
|
||||
import {
|
||||
readRuntimeModel,
|
||||
readRuntimeModelLimitOutput,
|
||||
@@ -38,9 +36,9 @@ export function getModelCapabilities(input: GetModelCapabilitiesInput): ModelCap
|
||||
input.runtimeModel ?? input.providerCache?.findProviderModelMetadata(input.providerID, input.modelID),
|
||||
)
|
||||
const runtimeSnapshot = input.runtimeSnapshot
|
||||
const bundledSnapshot = input.bundledSnapshot ?? getBundledModelCapabilitiesSnapshot()
|
||||
const bundledSnapshot = input.bundledSnapshot
|
||||
const snapshotEntry = runtimeSnapshot?.models?.[canonicalization.canonicalModelID]
|
||||
?? bundledSnapshot.models[canonicalization.canonicalModelID]
|
||||
?? bundledSnapshot?.models?.[canonicalization.canonicalModelID]
|
||||
const heuristicFamily = detectHeuristicModelFamily(canonicalization.canonicalModelID)
|
||||
|
||||
const runtimeVariants = readRuntimeModelVariants(runtimeModel)
|
||||
@@ -55,7 +53,7 @@ export function getModelCapabilities(input: GetModelCapabilitiesInput): ModelCap
|
||||
const snapshotSource: ModelCapabilitiesDiagnostics["snapshot"]["source"] =
|
||||
runtimeSnapshot?.models?.[canonicalization.canonicalModelID]
|
||||
? "runtime-snapshot"
|
||||
: bundledSnapshot.models[canonicalization.canonicalModelID]
|
||||
: bundledSnapshot?.models?.[canonicalization.canonicalModelID]
|
||||
? "bundled-snapshot"
|
||||
: "none"
|
||||
const familySource: ModelCapabilitiesDiagnostics["family"]["source"] =
|
||||
|
||||
Reference in New Issue
Block a user