vibeostheog 0.22.24 → 0.22.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/lib/pricing.js +18 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibeostheog",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.25",
|
|
4
4
|
"description": "Cost-aware delegation enforcer for OpenCode. Tracks model usage, routes Task subagents to cheaper tiers, surfaces cumulative savings in chat. Includes research audit, reporting framework, project memory, progressive scratchpad decadence, and trinity CLI for brain/medium/cheap slot switching.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"release": "node scripts/release.mjs",
|
package/src/lib/pricing.js
CHANGED
|
@@ -798,9 +798,6 @@ const DFLT_SEL = { enabled: true, active_slot: null, thinking_level: "off", flow
|
|
|
798
798
|
export function readConfig(dir) {
|
|
799
799
|
try {
|
|
800
800
|
const configs = [];
|
|
801
|
-
const workspaceModel = readWorkspaceSessionModel(dir);
|
|
802
|
-
if (workspaceModel)
|
|
803
|
-
return workspaceModel;
|
|
804
801
|
const projectCfg = readOpenCodeConfigObject(dir);
|
|
805
802
|
if (projectCfg && typeof projectCfg === "object")
|
|
806
803
|
configs.push(projectCfg);
|
|
@@ -810,6 +807,9 @@ export function readConfig(dir) {
|
|
|
810
807
|
if (homeCfg && typeof homeCfg === "object")
|
|
811
808
|
configs.push(homeCfg);
|
|
812
809
|
}
|
|
810
|
+
const workspaceModel = readWorkspaceSessionModel(dir);
|
|
811
|
+
if (workspaceModel)
|
|
812
|
+
return resolveConfiguredModelId(workspaceModel, configs) || workspaceModel;
|
|
813
813
|
const selectedCfg = configs[0] || {};
|
|
814
814
|
const selectedModel = selectedCfg?.agent?.build?.model || selectedCfg?.model || "";
|
|
815
815
|
return resolveConfiguredModelId(selectedModel, configs);
|
|
@@ -910,7 +910,7 @@ function readOpenCodeConfigObject(dir) {
|
|
|
910
910
|
}
|
|
911
911
|
function collectConfiguredProviderModelsFromConfig(cfg) {
|
|
912
912
|
const out = [];
|
|
913
|
-
const providers = cfg?.provider || {};
|
|
913
|
+
const providers = (cfg && typeof cfg === "object") ? (cfg?.provider || {}) : {};
|
|
914
914
|
for (const [providerName, providerCfg] of Object.entries(providers)) {
|
|
915
915
|
const models = providerCfg?.models || {};
|
|
916
916
|
for (const rawId of Object.keys(models)) {
|
|
@@ -937,11 +937,21 @@ function resolveConfiguredModelId(model, configs = []) {
|
|
|
937
937
|
matches.add(id);
|
|
938
938
|
}
|
|
939
939
|
}
|
|
940
|
+
if (matches.size === 0) {
|
|
941
|
+
// No exact match — try suffix/prefix match against bare model names
|
|
942
|
+
for (const cfg of configs) {
|
|
943
|
+
for (const id of collectConfiguredProviderModelsFromConfig(cfg)) {
|
|
944
|
+
const bare = String(id || "").includes("/") ? String(id).split("/").pop() : id;
|
|
945
|
+
const nb = normalizeModelId(bare);
|
|
946
|
+
if (nb.includes(normalized) || normalized.includes(nb))
|
|
947
|
+
matches.add(id);
|
|
948
|
+
}
|
|
949
|
+
}
|
|
950
|
+
}
|
|
940
951
|
if (matches.size === 0)
|
|
941
|
-
return
|
|
952
|
+
return "";
|
|
942
953
|
if (matches.size === 1)
|
|
943
954
|
return [...matches][0];
|
|
944
|
-
// Multiple providers have this model — prefer provider-qualified name over bare
|
|
945
955
|
const qualified = [...matches].find(m => m.includes("/"));
|
|
946
956
|
return qualified || raw;
|
|
947
957
|
}
|
|
@@ -1043,11 +1053,11 @@ export function _refreshModel(directory) {
|
|
|
1043
1053
|
}
|
|
1044
1054
|
}
|
|
1045
1055
|
// Reconcile with the directory's opencode.json config.
|
|
1046
|
-
// The trinity slot is authoritative UNLESS the directory config specifies a
|
|
1056
|
+
// The trinity slot is authoritative UNLESS the directory config specifies a resolveable model.
|
|
1047
1057
|
// This prevents the bootstrap's default slot from overriding a project-local model choice.
|
|
1048
1058
|
if (!_modelLocked) {
|
|
1049
1059
|
const cfgModel = readConfig(directory) || readConfig(getOpenCodeHome()) || "";
|
|
1050
|
-
if (cfgModel && cfgModel !== currentModel) {
|
|
1060
|
+
if (cfgModel && cfgModel.includes("/") && cfgModel !== currentModel) {
|
|
1051
1061
|
const oldModel = currentModel;
|
|
1052
1062
|
const oldTier = currentTier;
|
|
1053
1063
|
setCurrentModel(cfgModel);
|