vibeostheog 0.20.11 → 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.11",
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",
@@ -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();