obol-ai 0.3.48 → 0.3.49
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 +1 -1
- package/src/claude/router.js +9 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obol-ai",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.49",
|
|
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": {
|
package/src/claude/router.js
CHANGED
|
@@ -14,7 +14,7 @@ function buildRouterMessages(recentHistory, userMessage) {
|
|
|
14
14
|
return [...trimmed, { role: 'user', content: userMessage }];
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
function
|
|
17
|
+
function buildConversationQueries(recentHistory, userMessage, count = 5) {
|
|
18
18
|
const userMsgs = recentHistory
|
|
19
19
|
.filter(m => m.role === 'user')
|
|
20
20
|
.map(m => typeof m.content === 'string'
|
|
@@ -22,8 +22,12 @@ function extractRecentUserMessages(recentHistory, userMessage, count = 5) {
|
|
|
22
22
|
: m.content.filter(b => b.type === 'text').map(b => b.text).join(''))
|
|
23
23
|
.filter(Boolean)
|
|
24
24
|
.slice(-count);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
|
|
26
|
+
const queries = [userMessage];
|
|
27
|
+
if (userMsgs.length > 0) {
|
|
28
|
+
queries.push([...userMsgs, userMessage].join('\n'));
|
|
29
|
+
}
|
|
30
|
+
return queries;
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
function tokenize(s) {
|
|
@@ -85,8 +89,8 @@ If recent context shows an ongoing task (sonnet/opus was just used, multi-step w
|
|
|
85
89
|
|
|
86
90
|
if (decision.need_memory && memory) {
|
|
87
91
|
const budget = decision.model === 'opus' ? 60 : 40;
|
|
88
|
-
const poolPerQuery = decision.model === 'opus' ?
|
|
89
|
-
const conversationQueries =
|
|
92
|
+
const poolPerQuery = decision.model === 'opus' ? 40 : 30;
|
|
93
|
+
const conversationQueries = buildConversationQueries(recentHistory, userMessage);
|
|
90
94
|
|
|
91
95
|
const semanticResults = await Promise.all(
|
|
92
96
|
conversationQueries.map(q => memory.search(q, { limit: poolPerQuery, threshold: 0.4 }))
|