vibeostheog 0.20.10 → 0.20.12

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibeostheog",
3
- "version": "0.20.10",
3
+ "version": "0.20.12",
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",
@@ -89,4 +89,4 @@
89
89
  "dependencies": {
90
90
  "vibeoscore": "file:vibeoscore-1.0.2.tgz"
91
91
  }
92
- }
92
+ }
package/src/index.js CHANGED
@@ -164,8 +164,12 @@ async function _seedModelTiersIfMissing(directory) {
164
164
  const brain = ranked?.brain?.id || fallbackModel;
165
165
  const medium = ranked?.medium?.id || brain;
166
166
  const cheap = ranked?.cheap?.id || medium || brain;
167
- if (!brain)
168
- return false;
167
+ if (!brain) {
168
+ brain = "deepseek/deepseek-v4-pro";
169
+ medium = "deepseek/deepseek-v4-flash";
170
+ cheap = "deepseek/deepseek-chat";
171
+ console.error("[vibeOS] no providers detected — using default model tiers (brain=v4-pro, medium=v4-flash, cheap=v4-chat)");
172
+ }
169
173
  const tiers = {
170
174
  selection: {
171
175
  enabled: true,
@@ -6,7 +6,6 @@ export const SAVE_EST = {
6
6
  SOFT_QUOTA: 0.0001,
7
7
  // DeepSeek cache: (0.14 - 0.0028)/1M * ~1000 tokens = 0.00014
8
8
  CONTEXT7: 0.00014,
9
- OPUS_DISABLE: 1e-10,
10
9
  };
11
10
  export const WARN_ON_DIRECT = new Set(["write", "edit", "notebookedit"]);
12
11
  export const SOFT_QUOTA = new Set(["bash", "glob", "grep", "read", "webfetch", "websearch"]);
@@ -169,10 +169,20 @@ async function _appendFooter(input, output, directory) {
169
169
  null;
170
170
  if (messageID && textCompletePainted.has(messageID))
171
171
  return;
172
- const text = typeof output?.text === "string" ? output.text :
173
- typeof output?.result === "string" ? output.result :
174
- typeof output?.content === "string" ? output.content :
175
- "";
172
+ function _extractText(obj) {
173
+ if (typeof obj?.text === "string")
174
+ return obj.text;
175
+ if (typeof obj?.result === "string")
176
+ return obj.result;
177
+ if (typeof obj?.content === "string")
178
+ return obj.content;
179
+ if (Array.isArray(obj?.content))
180
+ return obj.content.filter(p => p?.type === "text").map(p => p.text).filter(Boolean).join("\n");
181
+ if (Array.isArray(obj?.parts))
182
+ return obj.parts.filter(p => p?.type === "text").map(p => p.text).filter(Boolean).join("\n");
183
+ return "";
184
+ }
185
+ const text = _extractText(output);
176
186
  if (!text) {
177
187
  if (messageID)
178
188
  textCompletePainted.add(messageID);
@@ -293,7 +303,7 @@ async function _appendFooter(input, output, directory) {
293
303
  if (_blackboxEnabled) {
294
304
  try {
295
305
  const prevText = _prevOutputText;
296
- _prevOutputText = typeof output?.text === "string" ? output.text : typeof output?.result === "string" ? output.result : "";
306
+ _prevOutputText = _extractText(output) || "";
297
307
  if (_prevOutputText && prevText && _prevOutputText !== prevText) {
298
308
  const outcome = detectOutcomeSignal(_prevOutputText);
299
309
  if (outcome) {
@@ -316,14 +326,31 @@ async function _appendFooter(input, output, directory) {
316
326
  }
317
327
  catch { }
318
328
  }
319
- if (typeof output?.text === "string")
320
- output.text = footerText;
321
- else if (typeof output?.result === "string")
322
- output.result = footerText;
323
- else if (typeof output?.content === "string")
324
- output.content = footerText;
325
- else
326
- output.text = footerText;
329
+ function _setFooter(obj, text) {
330
+ if (typeof obj?.text === "string")
331
+ obj.text = text;
332
+ else if (typeof obj?.result === "string")
333
+ obj.result = text;
334
+ else if (typeof obj?.content === "string")
335
+ obj.content = text;
336
+ else if (Array.isArray(obj?.content)) {
337
+ const textParts = obj.content.filter(p => p?.type === "text");
338
+ if (textParts.length > 0)
339
+ textParts[textParts.length - 1].text = text;
340
+ else
341
+ obj.content.push({ type: "text", text });
342
+ }
343
+ else if (Array.isArray(obj?.parts)) {
344
+ const textParts = obj.parts.filter(p => p?.type === "text");
345
+ if (textParts.length > 0)
346
+ textParts[textParts.length - 1].text = text;
347
+ else
348
+ obj.parts.push({ type: "text", text });
349
+ }
350
+ else
351
+ obj.text = text;
352
+ }
353
+ _setFooter(output, footerText);
327
354
  textCompletePainted.add(messageID);
328
355
  if (textCompletePainted.size > 500) {
329
356
  const it = textCompletePainted.values();
@@ -281,8 +281,7 @@ export function formatUsd(v) {
281
281
  // ── Free model exceptions ───────────────────────────────────────────
282
282
  // Models with negligible per-turn cost (less than 2e-5 USD/turn).
283
283
  // These skip enforcement entirely to avoid noise.
284
- // deepseek-chat is DEPRECATED by DeepSeek — now maps to v4-flash ($0.000182/turn).
285
- // No DeepSeek models are free. Only local models (Ollama) qualify.
284
+ // deepseek-chat is free with a DeepSeek API token priced at $1e-12 (near-zero).
286
285
  const FREE_MODEL_TURN_USD = 1e-10;
287
286
  const FREE_MODELS = new Set([]);
288
287
  // Approximate USD per typical ~1 K-token turn (blended input+output).
@@ -302,8 +301,8 @@ const MODEL_USD_PER_TURN = {
302
301
  // ── DeepSeek (OC platform + OpenRouter) ──────────────────
303
302
  "deepseek/deepseek-v4-pro": 0.00057,
304
303
  "deepseek/deepseek-v4-flash": 0.000182,
305
- "deepseek/deepseek-chat": 0.000182,
306
- "deepseek-chat": 0.000182,
304
+ "deepseek/deepseek-chat": 0.000000000001,
305
+ "deepseek-chat": 0.000000000001,
307
306
  "deepseek/deepseek-v3": 0.000182,
308
307
  "deepseek/deepseek-r1": 0.00124,
309
308
  "deepseek/deepseek-reasoner": 0.000182,