obol-ai 0.1.6 → 0.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "obol-ai",
3
- "version": "0.1.6",
3
+ "version": "0.1.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": {
package/src/claude.js CHANGED
@@ -73,8 +73,9 @@ async function ensureFreshToken(anthropicConfig) {
73
73
  _refreshPromise = (async () => {
74
74
  try {
75
75
  const tokens = await refreshTokens(anthropicConfig.oauth.refreshToken);
76
+ console.log('[oauth] Refresh succeeded, new refresh token:', !!tokens.refreshToken);
76
77
  anthropicConfig.oauth.accessToken = tokens.accessToken;
77
- anthropicConfig.oauth.refreshToken = tokens.refreshToken;
78
+ if (tokens.refreshToken) anthropicConfig.oauth.refreshToken = tokens.refreshToken;
78
79
  anthropicConfig.oauth.expires = tokens.expires;
79
80
  delete anthropicConfig._oauthFailed;
80
81
 
package/src/oauth.js CHANGED
@@ -82,10 +82,11 @@ async function refreshTokens(refreshToken) {
82
82
  }
83
83
 
84
84
  const data = await res.json();
85
+ console.log(`[oauth] Refresh response: expires_in=${data.expires_in}, has_refresh=${!!data.refresh_token}`);
85
86
  return {
86
87
  accessToken: data.access_token,
87
- refreshToken: data.refresh_token,
88
- expires: Date.now() + data.expires_in * 1000 - REFRESH_BUFFER_MS,
88
+ refreshToken: data.refresh_token || null,
89
+ expires: Date.now() + (data.expires_in || 3600) * 1000 - REFRESH_BUFFER_MS,
89
90
  };
90
91
  }
91
92
 
package/src/post-setup.js CHANGED
@@ -3,13 +3,13 @@ const path = require('path');
3
3
  const { execSync, spawnSync } = require('child_process');
4
4
  const { OBOL_DIR, loadConfig, saveConfig } = require('./config');
5
5
 
6
- function isPostSetupDone(userDir) {
7
- const flag = path.join(userDir || OBOL_DIR, '.post-setup-complete');
6
+ function isPostSetupDone() {
7
+ const flag = path.join(OBOL_DIR, '.post-setup-complete');
8
8
  return fs.existsSync(flag);
9
9
  }
10
10
 
11
- function markPostSetupDone(userDir) {
12
- const flag = path.join(userDir || OBOL_DIR, '.post-setup-complete');
11
+ function markPostSetupDone() {
12
+ const flag = path.join(OBOL_DIR, '.post-setup-complete');
13
13
  fs.writeFileSync(flag, JSON.stringify({
14
14
  completedAt: new Date().toISOString(),
15
15
  tasks: SETUP_TASKS.map(t => t.name),
@@ -402,12 +402,12 @@ APT::Periodic::AutocleanInterval "7";
402
402
 
403
403
  // ─── RUNNER ───
404
404
 
405
- async function runPostSetup(config, reportFn, userDir) {
406
- if (isPostSetupDone(userDir)) return;
405
+ async function runPostSetup(config, reportFn) {
406
+ if (isPostSetupDone()) return;
407
407
 
408
408
  if (process.platform !== 'linux') {
409
409
  reportFn?.(`⚠️ Post-setup tasks are designed for Linux VPS servers. Skipping on ${process.platform}.`);
410
- markPostSetupDone(userDir);
410
+ markPostSetupDone();
411
411
  return [];
412
412
  }
413
413
 
@@ -421,7 +421,7 @@ async function runPostSetup(config, reportFn, userDir) {
421
421
  reportFn?.(` ${result.success ? '✅' : '⚠️'} ${result.message}`);
422
422
  }
423
423
 
424
- markPostSetupDone(userDir);
424
+ markPostSetupDone();
425
425
 
426
426
  const summary = results.map(r => `${r.success ? '✅' : '⚠️'} ${r.name}: ${r.message}`).join('\n');
427
427
  reportFn?.(`\n🪙 Post-setup complete!\n${summary}`);
package/src/telegram.js CHANGED
@@ -293,11 +293,11 @@ function createBot(telegramConfig, config) {
293
293
 
294
294
  setImmediate(async () => {
295
295
  try {
296
- if (!isPostSetupDone(tenant.userDir)) {
296
+ if (!isPostSetupDone()) {
297
297
  const rawCfg = loadConfig({ resolve: false });
298
298
  await runPostSetup(rawCfg, async (m) => {
299
299
  await ctx.reply(m).catch(() => {});
300
- }, tenant.userDir);
300
+ });
301
301
  }
302
302
  } catch (e) {
303
303
  console.error('Post-setup error:', e.message);