vibeostheog 0.24.2 → 0.24.5

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/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.24.5
2
+ - fix: cap saveEst at to prevent runaway pricing data corruption
3
+ - chore: v0.24.4
4
+
5
+
1
6
  ## 0.23.61
2
7
  - chore: clean TS source warnings and bump patch
3
8
 
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Cost-aware control plane for OpenCode Desktop.
4
4
 
5
- > ## v0.23.61 — Return
5
+ > ## v0.24.0 — Return
6
6
  > Compact footer format: `🦠 brain | Deepseek | V4 Pro | $12.57 | VibeMaX ⚡ Budget`
7
7
  > VibeMaX is now the default optimization mode. Model display names cleaned up (V4 Pro, Sonnet, 2.5 Flash).
8
8
  > Install: `npx vibeostheog setup --project` or `npx vibeostheog setup`
package/dist/vibeOS.js CHANGED
@@ -436,7 +436,7 @@ function autoSelectMode(subRegime, stressMultiplier) {
436
436
  if (regime === "LOOPING") return "speed";
437
437
  if (regime === "CONVERGING" || regime === "CLOSED") return "quality";
438
438
  if (stressMultiplier && stressMultiplier > QUALITY_STRESS_THRESHOLD) return "quality";
439
- return "vibelitex";
439
+ return "litex";
440
440
  }
441
441
  var REGIME_CONTROL, DEFAULT_CONTROL, QUALITY_STRESS_THRESHOLD;
442
442
  var init_meta_controller = __esm({
@@ -6074,9 +6074,22 @@ function classifyTurnSimple(userText) {
6074
6074
  if (/(inject|exploit|penetration|cve|attack|threat|encrypt|forensic|research|deep analysis|investigate|root cause|reverse engineer|disassemble|memory dump|core dump)/i.test(lower)) {
6075
6075
  return "FORENSIC";
6076
6076
  }
6077
- if (/^(how|what|why|when|where|who|can you|could you|tell me|explain|describe|show|list|check|is there|are there|does|do you|summarize|elaborate|clarify|inspect|trace|find|search|look|read|show me|dump)/i.test(lower)) {
6077
+ const IMPL_VERBS = "fix|write|create|build|implement|change|edit|modify|update|refactor|generate|delete|remove|migrate|deploy|commit|push";
6078
+ if (new RegExp("^(can you|could you|tell me|we should|we need to|please) (" + IMPL_VERBS + ")\\b", "i").test(lower)) {
6079
+ return "REFINING";
6080
+ }
6081
+ if (new RegExp("^I (need|want|would like) to (" + IMPL_VERBS + ")\\b", "i").test(lower)) {
6082
+ return "REFINING";
6083
+ }
6084
+ if (/^(the |there is |there are |i think |looks like |seems like |i see |why (is|are|does|did) )/i.test(lower)) {
6078
6085
  return "EXPLORING";
6079
6086
  }
6087
+ if (/^(how|what|why|when|where|who|can you|could you|let me|tell me|explain|describe|show|list|check|is there|are there|does|do you|summarize|elaborate|clarify|inspect|trace|find|search|look|read|show me|dump|debug)/i.test(lower)) {
6088
+ return "EXPLORING";
6089
+ }
6090
+ if (new RegExp("\\b(" + IMPL_VERBS + ")\\b", "i").test(lower)) {
6091
+ return "REFINING";
6092
+ }
6080
6093
  if (/^(write|create|add|build|implement|fix|change|edit|modify|update|refactor|generate|make|commit|push|deploy|release|publish|install|remove|delete|rename|move|copy|transform|convert|migrate)/i.test(lower)) {
6081
6094
  return "REFINING";
6082
6095
  }
@@ -6128,6 +6141,21 @@ function isLikelyOffTopic(userText, job) {
6128
6141
  }
6129
6142
 
6130
6143
  // src/lib/turn-classify.ts
6144
+ function classifyTurnSimple2(userText) {
6145
+ return classifyTurnSimple(userText);
6146
+ }
6147
+ async function classifyTurnRemote(text) {
6148
+ try {
6149
+ const client2 = getApiClient2();
6150
+ if (!client2 || isApiFallback()) return classifyTurnSimple(text);
6151
+ const res = await client2.classifyQuery(text);
6152
+ if (res && typeof res === "object" && "sub_regime" in res) {
6153
+ return res.sub_regime;
6154
+ }
6155
+ } catch {
6156
+ }
6157
+ return classifyTurnSimple(text);
6158
+ }
6131
6159
  function getVibeOSHome5() {
6132
6160
  return process.env.VIBEOS_HOME || join7(process.env.HOME || "", ".claude");
6133
6161
  }
@@ -6190,7 +6218,9 @@ function computeControlVector2(_state, _action, _optimizationMode) {
6190
6218
  wbp_verbosity: isStrict ? "verbose" : isRelaxed ? "minimal" : "normal",
6191
6219
  agent_mode: (subRegime === "REFINING" || subRegime === "CONVERGING" || subRegime === "CLOSED") && stress <= QUALITY_STRESS_THRESHOLD2 ? "plan" : void 0,
6192
6220
  optimization_mode: mode,
6193
- directives: []
6221
+ directives: isRelaxed && (subRegime === "EXPLORING" || subRegime === "INIT" || subRegime === "AUDIT" || subRegime === "FORENSIC" || subRegime === "LOOPING") ? [
6222
+ `[speed guard] VERIFY BEFORE ACT - Speed-oriented mode "${mode}" is active and user intent is ${subRegime}. Before modifying files or executing commands, first verify the current state. When a request is ambiguous between "check and report" vs "fix", always choose CHECK FIRST. Treat "look at", "check", "investigate", "tell me about" as requests for information, not action items.`
6223
+ ] : []
6194
6224
  };
6195
6225
  }
6196
6226
  function buildControlHistoryEntry2(turn, regime, control, reward = null) {
@@ -9341,9 +9371,11 @@ function observeToolPattern(toolName, input, output, directory3) {
9341
9371
  } catch {
9342
9372
  }
9343
9373
  }
9374
+ var MAX_SAVE_EST_PER_WARN = 5;
9344
9375
  function recordSaving(tool2, reason, saveEst, meta = {}) {
9345
9376
  try {
9346
9377
  if (!saveEst || saveEst <= 0) return 0;
9378
+ if (saveEst > MAX_SAVE_EST_PER_WARN) saveEst = MAX_SAVE_EST_PER_WARN;
9347
9379
  const firstWord = meta?.firstWord || tool2 || "";
9348
9380
  updateState((s) => {
9349
9381
  s.lifetime ??= { total_savings_usd: 0, cache_savings_usd: 0, missed_context7_usd: 0, session_count: 0, warn_count: 0 };
@@ -9359,9 +9391,6 @@ function recordSaving(tool2, reason, saveEst, meta = {}) {
9359
9391
  }
9360
9392
  }
9361
9393
  const ses = s.sessions[sid];
9362
- ses.total_savings_usd = roundUsd(Number(ses.total_savings_usd || 0) + saveEst);
9363
- s.lifetime.total_savings_usd = roundUsd(Number(s.lifetime.total_savings_usd || 0) + saveEst);
9364
- s.lifetime.warn_count = (s.lifetime.warn_count || 0) + 1;
9365
9394
  if (reason && firstWord) {
9366
9395
  const now = Date.now();
9367
9396
  const warnKey = `${_OC_SID}:${firstWord}`;
@@ -9371,13 +9400,13 @@ function recordSaving(tool2, reason, saveEst, meta = {}) {
9371
9400
  const w = ses.warns[i];
9372
9401
  if (w?.key === warnKey && now - w.ts < WARN_DEDUPE_WINDOW_MS) {
9373
9402
  w.count = (w.count || 1) + 1;
9374
- w.reason = reason;
9375
- w.saveEst = (w.saveEst || 0) + saveEst;
9376
- w.est_savings_usd = (w.est_savings_usd || 0) + saveEst;
9377
9403
  deduped = true;
9378
9404
  }
9379
9405
  }
9380
9406
  if (!deduped) {
9407
+ ses.total_savings_usd = roundUsd(Number(ses.total_savings_usd || 0) + saveEst);
9408
+ s.lifetime.total_savings_usd = roundUsd(Number(s.lifetime.total_savings_usd || 0) + saveEst);
9409
+ s.lifetime.warn_count = (s.lifetime.warn_count || 0) + 1;
9381
9410
  ses.warns.push({ key: warnKey, reason, saveEst, est_savings_usd: saveEst, firstWord, ts: now, count: 1, tool: tool2 });
9382
9411
  }
9383
9412
  if (!ses.seenWarnKeys[warnKey]) {
@@ -9570,7 +9599,7 @@ async function apiComputeControlVector(state, action, optimizationMode) {
9570
9599
  const res = await remoteCall("blackboxControlVector", [state, action, optimizationMode], null);
9571
9600
  if (res?.control_vector) {
9572
9601
  const local = computeControlVector2(state, action, optimizationMode);
9573
- return { ...res.control_vector, tier_bias: local.tier_bias, optimization_mode: local.optimization_mode };
9602
+ return { ...res.control_vector, tier_bias: local.tier_bias, optimization_mode: local.optimization_mode, enforcement_mode: local.enforcement_mode, flow_mode: local.flow_mode, tdd_mode: local.tdd_mode, thinking_mode: local.thinking_mode };
9574
9603
  }
9575
9604
  } catch {
9576
9605
  }
@@ -9713,6 +9742,7 @@ function syncControlSettings(cv, options = {}) {
9713
9742
  }
9714
9743
  writeIf("enabled", true);
9715
9744
  const compatibilityMode = currentSel.onboarding_mode === "assist";
9745
+ writeIf("delegation_enforce", compatibilityMode ? cv.enforcement_mode === "strict" : cv.enforcement_mode !== "relaxed");
9716
9746
  if (compatibilityMode) {
9717
9747
  writeIf("flow_enabled", cv.flow_mode === "strict");
9718
9748
  writeIf("flow_enforce", cv.flow_mode === "strict");
@@ -10024,15 +10054,16 @@ var onSystemTransform = async (_input, output) => {
10024
10054
  if (typeof userText === "string" && userText.trim()) latestUserIntent = userText;
10025
10055
  else if (!latestUserIntent) latestUserIntent = null;
10026
10056
  if (latestUserIntent) observeUserCorrection(latestUserIntent);
10057
+ const classifiedRegime = _latestBlackboxState3?.sub_regime || (latestUserIntent ? await classifyTurnRemote(latestUserIntent) : "INIT");
10027
10058
  const optimizationSuggestion = await selectOptimizationModeRemote(
10028
- _latestBlackboxState3?.sub_regime || (latestUserIntent ? classifyTurnSimple(latestUserIntent) : "INIT"),
10059
+ classifiedRegime,
10029
10060
  latestUserIntent ? scoreStress(latestUserIntent) : 0,
10030
10061
  loadOptimizationMode()
10031
10062
  );
10032
10063
  const optimizationDecision = applyBudgetFirstMode({
10033
10064
  requestedMode: loadOptimizationMode(),
10034
10065
  suggestedMode: optimizationSuggestion,
10035
- subRegime: _latestBlackboxState3?.sub_regime || (latestUserIntent ? classifyTurnSimple(latestUserIntent) : "INIT"),
10066
+ subRegime: classifiedRegime,
10036
10067
  stress: latestUserIntent ? scoreStress(latestUserIntent) : 0,
10037
10068
  nInteractions: _latestBlackboxState3?.n_interactions ?? 0
10038
10069
  });
@@ -10046,7 +10077,7 @@ var onSystemTransform = async (_input, output) => {
10046
10077
  } else if (latestUserIntent) {
10047
10078
  const st = scoreStress(latestUserIntent);
10048
10079
  _controlVector = await apiComputeControlVector({
10049
- sub_regime: classifyTurnSimple(latestUserIntent),
10080
+ sub_regime: classifiedRegime,
10050
10081
  latest_stress_multiplier: st || void 0
10051
10082
  }, void 0, optimizationMode);
10052
10083
  }
@@ -10207,7 +10238,7 @@ var onSystemTransform = async (_input, output) => {
10207
10238
  }
10208
10239
  const calDir = getVibeOSHome9();
10209
10240
  const calFile = join14(calDir, "calibration-data.jsonl");
10210
- const regime2 = _latestBlackboxState3?.sub_regime || classifyTurnSimple(latestUserIntent || "");
10241
+ const regime2 = _latestBlackboxState3?.sub_regime || classifyTurnSimple2(latestUserIntent || "");
10211
10242
  const calRecord = JSON.stringify({
10212
10243
  ts: (/* @__PURE__ */ new Date()).toISOString(),
10213
10244
  sid: _OC_SID4,
@@ -10239,6 +10270,17 @@ var onSystemTransform = async (_input, output) => {
10239
10270
  };
10240
10271
 
10241
10272
  // src/lib/hooks/shared-footer.ts
10273
+ var REGIME_TAG = {
10274
+ INIT: "INIT",
10275
+ DIVERGENT: "DVRG",
10276
+ EXPLORING: "XPLR",
10277
+ REFINING: "RFNE",
10278
+ CONVERGING: "CVGE",
10279
+ CLOSED: "CLSD",
10280
+ LOOPING: "LOOP",
10281
+ AUDIT: "AUDT",
10282
+ FORENSIC: "FRNC"
10283
+ };
10242
10284
  var BRAND_MAP = {
10243
10285
  vibeultrax: "VibeUltraX",
10244
10286
  vibeqmax: "VibeQMaX",
@@ -10302,9 +10344,10 @@ function buildEnforcementTags(opts) {
10302
10344
  return tags;
10303
10345
  }
10304
10346
  function buildFooterLine(input) {
10305
- const { activeSlot, sessionSlot, providerLabel, modelName, ltTotal, ltTrend, vibeBrand, optMode, flashIcon, enfTags, vectorChangedSlot } = input;
10347
+ const { activeSlot, sessionSlot, providerLabel, modelName, ltTotal, ltTrend, vibeBrand, optMode, flashIcon, enfTags, vectorChangedSlot, subRegime } = input;
10306
10348
  const tierIcon = resolveTierIcon(activeSlot);
10307
- let line = `\u2014 ${tierIcon} ${activeSlot} | ${providerLabel} | ${modelName}`;
10349
+ const regimeTag = subRegime ? REGIME_TAG[subRegime] || subRegime.slice(0, 4) : null;
10350
+ let line = `\u2014 ${tierIcon} ${activeSlot} | ${providerLabel} | ${modelName}${regimeTag ? ` \u25B6 ${regimeTag}` : ""}`;
10308
10351
  if (ltTotal > 0) {
10309
10352
  const savingsPulse = formatSavingsPulse(ltTotal, ltTrend);
10310
10353
  if (savingsPulse) line += ` | ${savingsPulse}`;
@@ -10527,7 +10570,7 @@ async function _appendFooter(input, output, directory3) {
10527
10570
  });
10528
10571
  const resolvedMode = peekBudgetFirstMode({
10529
10572
  requestedMode: optModeFooter,
10530
- subRegime: _latestBlackboxState?.sub_regime || classifyTurnSimple(latestUserIntent || ""),
10573
+ subRegime: _latestBlackboxState?.sub_regime || classifyTurnSimple2(latestUserIntent || ""),
10531
10574
  stress: _footerStress
10532
10575
  }).mode;
10533
10576
  const stripped = text.replace(/\u2014 [^\u2014]+ \u2014\s*/g, "").trimEnd();
@@ -10539,6 +10582,7 @@ async function _appendFooter(input, output, directory3) {
10539
10582
  const vibeBrand = resolveBrand(optModeFooter, activeSlot);
10540
10583
  const flashIcon = isApiConnected2() ? " \u26A1" : "";
10541
10584
  const displayMode = selNowFooter?.optimization_mode || optMode || "auto";
10585
+ const currentSubRegime = _latestBlackboxState?.sub_regime || classifyTurnSimple2(latestUserIntent || "");
10542
10586
  const vibeLine = buildFooterLine({
10543
10587
  activeSlot,
10544
10588
  providerLabel: execution.provider_label,
@@ -10550,7 +10594,8 @@ async function _appendFooter(input, output, directory3) {
10550
10594
  flashIcon,
10551
10595
  enfTags,
10552
10596
  sessionSlot,
10553
- vectorChangedSlot: selNowFooter?.vector_changed_slot
10597
+ vectorChangedSlot: selNowFooter?.vector_changed_slot,
10598
+ subRegime: currentSubRegime
10554
10599
  });
10555
10600
  const footerText = stripped + `
10556
10601
 
@@ -10564,7 +10609,7 @@ ${vibeLine}`;
10564
10609
  if (outcome) {
10565
10610
  recordBudgetFirstOutcome({
10566
10611
  outcome,
10567
- subRegime: _latestBlackboxState?.sub_regime || classifyTurnSimple(latestUserIntent || ""),
10612
+ subRegime: _latestBlackboxState?.sub_regime || classifyTurnSimple2(latestUserIntent || ""),
10568
10613
  stress: _footerStress
10569
10614
  });
10570
10615
  const tracker = getBlackboxTracker();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibeostheog",
3
- "version": "0.24.2",
3
+ "version": "0.24.5",
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",