vibeostheog 0.23.47 → 0.23.48

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.23.47",
3
+ "version": "0.23.48",
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",
@@ -532,9 +532,13 @@ export function setApiToken(newToken) {
532
532
  VIBEOS_API_TOKEN = normalizeApiToken(newToken, EMBEDDED_API_TOKEN);
533
533
  VIBEOS_API_BOOTSTRAP_TOKEN = readBootstrapTokenFromDisk() || VIBEOS_API_BOOTSTRAP_TOKEN;
534
534
  VIBEOS_API_ENABLED = process.env.VIBEOS_API_ENABLED !== "false" && (!!VIBEOS_API_TOKEN || !!VIBEOS_API_BOOTSTRAP_TOKEN);
535
+ _apiClient = null;
536
+ _apiFallbackMode = false;
537
+ _apiFallbackSince = null;
535
538
  persistPrimaryApiEnvState({ token: VIBEOS_API_TOKEN, disabled: false });
536
539
  if (_anomalyDetector)
537
540
  _anomalyDetector.reset();
541
+ resetApiConnection();
538
542
  console.error("[vibeOS] API token updated via setApiToken");
539
543
  }
540
544
  catch (e) {
@@ -96,7 +96,10 @@ export function classifyTurnSimple(userText) {
96
96
  const lower = String(userText || "").trim();
97
97
  if (!lower)
98
98
  return "INIT";
99
- if (/(security|vulnerability|audit|owasp|inject|exploit|penetration|cve|attack|threat|compliance|gdpr|privacy|encrypt|xss|csrf|authn|authz|pentest|forensic|research|analyze dependencies|license audit|deep analysis|investigate|root cause|reverse engineer|disassemble|memory dump|core dump)/i.test(lower)) {
99
+ if (/(security|vulnerability|audit|owasp|compliance|gdpr|privacy|analyze dependencies|license audit)/i.test(lower)) {
100
+ return "AUDIT";
101
+ }
102
+ if (/(inject|exploit|penetration|cve|attack|threat|encrypt|xss|csrf|authn|authz|pentest|forensic|research|deep analysis|investigate|root cause|reverse engineer|disassemble|memory dump|core dump)/i.test(lower)) {
100
103
  return "FORENSIC";
101
104
  }
102
105
  // Q&A / research patterns -> EXPLORING (relaxed enforcement)
@@ -75,15 +75,12 @@ async function apiComputeControlVector(state, action, optimizationMode) {
75
75
  const res = await remoteCall("blackboxControlVector", [state, action, optimizationMode], null);
76
76
  if (res?.control_vector) {
77
77
  const local = computeControlVector(state, action, optimizationMode);
78
- const cv = { agent_mode: local.agent_mode, ...res.control_vector, tier_bias: local.tier_bias, optimization_mode: local.optimization_mode };
79
- delete cv.agent_mode;
78
+ const cv = { ...res.control_vector, agent_mode: local.agent_mode, tier_bias: local.tier_bias, optimization_mode: local.optimization_mode };
80
79
  return cv;
81
80
  }
82
81
  }
83
82
  catch { }
84
- const fallbackCv = computeControlVector(state, action, optimizationMode);
85
- delete fallbackCv.agent_mode;
86
- return fallbackCv;
83
+ return computeControlVector(state, action, optimizationMode);
87
84
  }
88
85
  function observeUserCorrection(text) {
89
86
  if (!text || typeof text !== "string")
@@ -36,8 +36,8 @@ export function createTrinityTool(deps) {
36
36
  "Use action='api-bootstrap-token' with token='<new_token>' to store an alpha bootstrap token and exchange it for a normal API token on alpha builds. " +
37
37
  "Call this when the user says things like 'switch to medium', 'use cheap model', 'disable plugin', 'trinity status'.",
38
38
  args: {
39
- action: deps.tool.schema.enum(["status", "enable", "disable", "set", "mode", "thinking", "flow", "tdd", "setup", "project", "patterns", "rebuild", "diagnose", "help", "enforce", "repair-state", "blackbox", "report", "target", "guard", "api-token", "api-bootstrap-token", "todo", "todo-done", "todo-sync"]).optional(),
40
- slot: deps.tool.schema.enum(["brain", "medium", "cheap", "budget", "quality", "speed", "longrun", "auto", "vibeultrax", "on", "off", "enforce", "strict", "preview", "apply", "clear", "savings"]).optional(),
39
+ action: deps.tool.schema.enum(["status", "enable", "disable", "set", "mode", "thinking", "flow", "tdd", "setup", "project", "patterns", "rebuild", "diagnose", "help", "enforce", "repair-state", "blackbox", "report", "target", "guard", "api-token", "api-bootstrap-token", "todo", "todo-done", "todo-sync", "audit", "forensic", "balanced", "vibeqmax", "vibemax"]).optional(),
40
+ slot: deps.tool.schema.enum(["brain", "medium", "cheap", "budget", "quality", "speed", "longrun", "auto", "balanced", "audit", "forensic", "vibeultrax", "vibeqmax", "vibemax", "on", "off", "enforce", "strict", "preview", "apply", "clear", "savings"]).optional(),
41
41
  level: deps.tool.schema.enum(["full", "brief", "off", "on"]).optional(),
42
42
  token: deps.tool.schema.string().optional(),
43
43
  },
@@ -91,14 +91,14 @@ export async function selectOptimizationModeRemote(subRegime, stressMultiplier,
91
91
  }
92
92
  function computeControlVector(_state, _action, _optimizationMode) {
93
93
  const mode = resolveOptimizationMode(_state?.sub_regime, _state?.latest_stress_multiplier, _optimizationMode);
94
- const isStrict = mode === "quality" || mode === "vibemax";
94
+ const isStrict = mode === "quality" || mode === "vibemax" || mode === "forensic" || mode === "audit";
95
95
  const isRelaxed = mode === "budget" || mode === "speed";
96
96
  const subRegime = _state?.sub_regime || "INIT";
97
97
  const stress = Number(_state?.latest_stress_multiplier ?? 0);
98
98
  const tierBias = stress > QUALITY_STRESS_THRESHOLD ? "brain"
99
99
  : subRegime === "CONVERGING" || subRegime === "CLOSED" ? "brain"
100
100
  : subRegime === "REFINING" || subRegime === "LOOPING" ? "medium"
101
- : mode === "quality" || mode === "longrun" ? "brain"
101
+ : mode === "quality" || mode === "longrun" || mode === "forensic" || mode === "audit" ? "brain"
102
102
  : mode === "speed" || mode === "vibemax" ? "medium"
103
103
  : mode === "balanced" ? "auto"
104
104
  : "cheap";
@@ -96,6 +96,32 @@ const REGIME_CONTROL = {
96
96
  context7_urgency: "required",
97
97
  wbp_verbosity: "minimal",
98
98
  },
99
+ FORENSIC: {
100
+ enforcement_mode: "strict",
101
+ enforcement_reason: "forensic analysis — full enforcement, deep investigation",
102
+ flow_mode: "strict",
103
+ flow_focus: ["write-edit-check", "no-untouched-files", "trace-audit"],
104
+ tdd_mode: "quality",
105
+ tdd_focus: ["full-coverage", "edge-cases", "property-based"],
106
+ tier_bias: "brain",
107
+ thinking_mode: "full",
108
+ stress_multiplier: 1.5,
109
+ context7_urgency: "required",
110
+ wbp_verbosity: "detailed",
111
+ },
112
+ AUDIT: {
113
+ enforcement_mode: "strict",
114
+ enforcement_reason: "security audit — full enforcement, OWASP validation",
115
+ flow_mode: "strict",
116
+ flow_focus: ["write-edit-check", "no-untouched-files", "security-scan"],
117
+ tdd_mode: "quality",
118
+ tdd_focus: ["full-coverage", "edge-cases", "security-test"],
119
+ tier_bias: "brain",
120
+ thinking_mode: "full",
121
+ stress_multiplier: 1.2,
122
+ context7_urgency: "required",
123
+ wbp_verbosity: "detailed",
124
+ },
99
125
  };
100
126
  const DEFAULT_CONTROL = REGIME_CONTROL.EXPLORING;
101
127
  const QUALITY_STRESS_THRESHOLD = 1.5;
@@ -206,6 +232,36 @@ const MODE_DELTAS = {
206
232
  api_enrichment: true,
207
233
  outcome_detection: true,
208
234
  },
235
+ forensic: {
236
+ tier_bias: "brain",
237
+ thinking_mode: "full",
238
+ tdd_mode: "quality",
239
+ tdd_focus: ["full-coverage", "edge-cases", "property-based"],
240
+ flow_mode: "strict",
241
+ flow_focus: ["write-edit-check", "no-untouched-files", "trace-audit"],
242
+ enforcement_mode: "strict",
243
+ wbp_verbosity: "detailed",
244
+ context7_urgency: "required",
245
+ stress_multiplier: 1.5,
246
+ loop_threshold: 0.4,
247
+ api_enrichment: true,
248
+ outcome_detection: true,
249
+ },
250
+ audit: {
251
+ tier_bias: "brain",
252
+ thinking_mode: "full",
253
+ tdd_mode: "quality",
254
+ tdd_focus: ["full-coverage", "edge-cases", "security-test"],
255
+ flow_mode: "strict",
256
+ flow_focus: ["write-edit-check", "no-untouched-files", "security-scan"],
257
+ enforcement_mode: "strict",
258
+ wbp_verbosity: "detailed",
259
+ context7_urgency: "required",
260
+ stress_multiplier: 1.2,
261
+ loop_threshold: 0.5,
262
+ api_enrichment: true,
263
+ outcome_detection: true,
264
+ },
209
265
  };
210
266
  export function autoSelectMode(subRegime, stressMultiplier) {
211
267
  const regime = String(subRegime || "INIT").toUpperCase();