obol-ai 0.2.20 → 0.2.22
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 +4 -0
- package/bin/obol.js +8 -0
- package/package.json +1 -1
- package/src/claude/chat.js +11 -9
- package/src/cli/config.js +1 -1
- package/src/cli/reauth.js +13 -0
- package/src/telegram/handlers/text.js +1 -1
package/CHANGELOG.md
CHANGED
package/bin/obol.js
CHANGED
|
@@ -86,4 +86,12 @@ program
|
|
|
86
86
|
await deleteAll();
|
|
87
87
|
});
|
|
88
88
|
|
|
89
|
+
program
|
|
90
|
+
.command('reauth')
|
|
91
|
+
.description('Re-authenticate with Anthropic OAuth')
|
|
92
|
+
.action(async () => {
|
|
93
|
+
const { reauth } = require('../src/cli/reauth');
|
|
94
|
+
await reauth();
|
|
95
|
+
});
|
|
96
|
+
|
|
89
97
|
program.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obol-ai",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.22",
|
|
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/chat.js
CHANGED
|
@@ -120,7 +120,7 @@ function createClaude(anthropicConfig, { personality, memory, userDir = OBOL_DIR
|
|
|
120
120
|
const toolDefs = runnableTools.map(({ run, ...def }) => def);
|
|
121
121
|
const probe = await client.messages.create({
|
|
122
122
|
model: activeModel,
|
|
123
|
-
max_tokens:
|
|
123
|
+
max_tokens: 1024,
|
|
124
124
|
system: systemPrompt,
|
|
125
125
|
messages: withCacheBreakpoints([...history]),
|
|
126
126
|
tools: toolDefs,
|
|
@@ -141,17 +141,19 @@ function createClaude(anthropicConfig, { personality, memory, userDir = OBOL_DIR
|
|
|
141
141
|
|
|
142
142
|
const runner = client.beta.messages.toolRunner({
|
|
143
143
|
model: activeModel,
|
|
144
|
-
max_tokens:
|
|
144
|
+
max_tokens: 128000,
|
|
145
145
|
system: systemPrompt,
|
|
146
146
|
messages: withCacheBreakpoints([...history]),
|
|
147
147
|
tools: runnableTools.length > 0 ? runnableTools : undefined,
|
|
148
148
|
max_iterations: getMaxToolIterations(),
|
|
149
|
+
stream: true,
|
|
149
150
|
}, { signal: abortController.signal });
|
|
150
151
|
|
|
151
152
|
let finalMessage;
|
|
152
|
-
for await (const
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
for await (const streamItem of runner) {
|
|
154
|
+
const msg = await streamItem.finalMessage();
|
|
155
|
+
finalMessage = msg;
|
|
156
|
+
trackUsage(msg.usage);
|
|
155
157
|
if (abortController.signal.aborted) break;
|
|
156
158
|
}
|
|
157
159
|
|
|
@@ -167,9 +169,9 @@ function createClaude(anthropicConfig, { personality, memory, userDir = OBOL_DIR
|
|
|
167
169
|
...bailoutResults,
|
|
168
170
|
{ type: 'text', text: 'You have used too many tool calls. Please provide a final response now based on what you have so far.' },
|
|
169
171
|
]);
|
|
170
|
-
const bailoutResponse = await client.messages.
|
|
172
|
+
const bailoutResponse = await client.messages.stream({
|
|
171
173
|
model: activeModel, max_tokens: 131072, system: systemPrompt, messages: withCacheBreakpoints([...histories.get(chatId)]),
|
|
172
|
-
}, { signal: abortController.signal });
|
|
174
|
+
}, { signal: abortController.signal }).finalMessage();
|
|
173
175
|
histories.pushAssistant(chatId, bailoutResponse.content);
|
|
174
176
|
trackUsage(bailoutResponse.usage);
|
|
175
177
|
const text = bailoutResponse.content.filter(b => b.type === 'text').map(b => b.text).join('\n');
|
|
@@ -181,9 +183,9 @@ function createClaude(anthropicConfig, { personality, memory, userDir = OBOL_DIR
|
|
|
181
183
|
if (!text.trim() && newMessages.length > 1) {
|
|
182
184
|
vlog('[claude] No text in final response after tool use — forcing summary');
|
|
183
185
|
histories.pushUser(chatId, 'Provide a concise response to the user based on the tool results above.');
|
|
184
|
-
const summaryResponse = await client.messages.
|
|
186
|
+
const summaryResponse = await client.messages.stream({
|
|
185
187
|
model: activeModel, max_tokens: 131072, system: systemPrompt, messages: withCacheBreakpoints([...histories.get(chatId)]),
|
|
186
|
-
}, { signal: abortController.signal });
|
|
188
|
+
}, { signal: abortController.signal }).finalMessage();
|
|
187
189
|
histories.pushAssistant(chatId, summaryResponse.content);
|
|
188
190
|
trackUsage(summaryResponse.usage);
|
|
189
191
|
text = summaryResponse.content.filter(b => b.type === 'text').map(b => b.text).join('\n');
|
package/src/cli/config.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const { loadConfig } = require('../config');
|
|
2
|
+
const { runOAuthFlow } = require('./config');
|
|
3
|
+
|
|
4
|
+
async function reauth() {
|
|
5
|
+
const cfg = loadConfig({ resolve: false });
|
|
6
|
+
if (!cfg) {
|
|
7
|
+
console.log('\n No config found. Run "obol init" first.\n');
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
await runOAuthFlow(cfg);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
module.exports = { reauth };
|
|
@@ -230,7 +230,7 @@ async function processTextMessage(ctx, fullMessage, { config, allowedUsers, bot,
|
|
|
230
230
|
stopTyping();
|
|
231
231
|
console.error('Message handling error:', e.message);
|
|
232
232
|
const errMsg = e.isOAuthExpiry
|
|
233
|
-
? `OAuth error: ${e.message}\n\nRun \`obol
|
|
233
|
+
? `OAuth error: ${e.message}\n\nRun \`obol reauth\` to re-authenticate.`
|
|
234
234
|
: (e.status === 401 || e.message?.includes('401'))
|
|
235
235
|
? 'API key invalid or expired. Run `obol config` to update.'
|
|
236
236
|
: (e.status === 429 || e.message?.includes('rate'))
|