obol-ai 0.3.7 → 0.3.8

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,6 @@
1
+ ## 0.3.8
2
+ - override haiku to sonnet when recent history has tool use
3
+
1
4
  ## 0.3.7
2
5
  - add impulse system, fix haiku context, enforce code block formatting
3
6
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obol-ai",
3
- "version": "0.3.7",
3
+ "version": "0.3.8",
4
4
  "description": "Self-evolving AI assistant that learns, remembers, and acts on its own. Persistent vector memory, self-rewriting personality, proactive heartbeats.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -41,6 +41,17 @@ function likelyNeedsTools(message) {
41
41
  return TOOL_PATTERNS.some(p => p.test(lower));
42
42
  }
43
43
 
44
+ function recentlyUsedTools(history) {
45
+ for (let i = history.length - 1; i >= Math.max(0, history.length - 4); i--) {
46
+ const msg = history[i];
47
+ if (msg.role === 'assistant' && Array.isArray(msg.content) &&
48
+ msg.content.some(b => b.type === 'tool_use')) {
49
+ return true;
50
+ }
51
+ }
52
+ return false;
53
+ }
54
+
44
55
  async function routeMessage(client, memory, userMessage, { vlog, onRouteDecision, onRouteUpdate, recentHistory = [], selfMemory = null }) {
45
56
  let memoryBlock = null;
46
57
  let model = null;
@@ -83,6 +94,11 @@ If recent context shows an ongoing task (sonnet/opus was just used, multi-step w
83
94
  decision.model = 'sonnet';
84
95
  }
85
96
 
97
+ if (decision.model === 'haiku' && recentlyUsedTools(recentHistory)) {
98
+ vlog('[router] haiku overridden → sonnet (recent tool use in history)');
99
+ decision.model = 'sonnet';
100
+ }
101
+
86
102
  vlog(`[router] model=${decision.model || 'sonnet'} memory=${decision.need_memory || false}${queries.length ? ` queries=${JSON.stringify(queries)}` : ''}`);
87
103
 
88
104
  onRouteDecision?.({