obol-ai 0.3.31 → 0.3.33
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 +6 -0
- package/package.json +1 -1
- package/src/telegram/schedule-wizard.js +6 -59
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "obol-ai",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.33",
|
|
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": {
|
|
@@ -78,36 +78,20 @@ async function stepTitle(ctx, userId) {
|
|
|
78
78
|
trackMsg(userId, msg.chat.id, msg.message_id);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
async function stepTime(ctx, userId) {
|
|
81
|
+
async function stepTime(ctx, userId, config) {
|
|
82
82
|
const draft = schedDrafts.get(userId);
|
|
83
83
|
if (!draft) return;
|
|
84
84
|
draft.step = 'time';
|
|
85
85
|
|
|
86
|
-
const {
|
|
87
|
-
|
|
88
|
-
try {
|
|
89
|
-
const tenant = await getTenant(userId, ctx._config || {});
|
|
90
|
-
if (tenant.memory) {
|
|
91
|
-
const hits = await tenant.memory.search('timezone', { limit: 1, threshold: 0.3 });
|
|
92
|
-
for (const h of hits) {
|
|
93
|
-
const match = h.content.match(/(?:timezone|time zone)[:\s]+([A-Za-z_/]+)/i);
|
|
94
|
-
if (match) { tz = match[1]; break; }
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
} catch {}
|
|
98
|
-
|
|
86
|
+
const { getUserTimezone } = require('../config');
|
|
87
|
+
const tz = getUserTimezone(config, userId);
|
|
99
88
|
draft.timezone = tz;
|
|
100
89
|
setPendingInput(userId, 'time', TIME_TTL_MS);
|
|
101
90
|
|
|
102
|
-
const kb = new InlineKeyboard()
|
|
103
|
-
.text(`Use ${tz}`, 'sched:tz:confirm')
|
|
104
|
-
.text('Change timezone', 'sched:tz:change');
|
|
105
|
-
|
|
106
91
|
const msg = await sendHtml(ctx,
|
|
107
92
|
`When should it ${draft.isRecurring ? 'first fire' : 'fire'}?\n\n` +
|
|
108
93
|
`Examples: \`2026-03-10 14:00\`, \`tomorrow at 9am\`\n` +
|
|
109
|
-
`Timezone: ${tz}
|
|
110
|
-
{ reply_markup: kb }
|
|
94
|
+
`Timezone: ${tz}`
|
|
111
95
|
);
|
|
112
96
|
trackMsg(userId, msg.chat.id, msg.message_id);
|
|
113
97
|
}
|
|
@@ -331,31 +315,10 @@ async function handleSchedCallback(ctx, data, answer, { getTenant, config, bot }
|
|
|
331
315
|
draft.isRecurring = value === 'recurring' || value === 'agentic-rec';
|
|
332
316
|
draft.isAgentic = value === 'agentic' || value === 'agentic-rec';
|
|
333
317
|
await answer();
|
|
334
|
-
ctx._config = config;
|
|
335
318
|
await stepTitle(ctx, userId);
|
|
336
319
|
return;
|
|
337
320
|
}
|
|
338
321
|
|
|
339
|
-
if (action === 'tz') {
|
|
340
|
-
const draft = schedDrafts.get(userId);
|
|
341
|
-
if (!draft) return answer({ text: 'Session expired' });
|
|
342
|
-
|
|
343
|
-
if (value === 'confirm') {
|
|
344
|
-
await answer();
|
|
345
|
-
return;
|
|
346
|
-
}
|
|
347
|
-
if (value === 'change') {
|
|
348
|
-
await answer();
|
|
349
|
-
cancelPending(userId);
|
|
350
|
-
setPendingInput(userId, 'timezone', TIME_TTL_MS);
|
|
351
|
-
const msg = await ctx.api.sendMessage(ctx.chat?.id || userId,
|
|
352
|
-
'Enter your timezone (e.g. Europe/Brussels, America/New_York, Asia/Tokyo):');
|
|
353
|
-
trackMsg(userId, msg.chat.id, msg.message_id);
|
|
354
|
-
return;
|
|
355
|
-
}
|
|
356
|
-
return answer();
|
|
357
|
-
}
|
|
358
|
-
|
|
359
322
|
if (action === 'cron') {
|
|
360
323
|
const draft = schedDrafts.get(userId);
|
|
361
324
|
if (!draft) return answer({ text: 'Session expired' });
|
|
@@ -432,7 +395,7 @@ async function handleSchedCallback(ctx, data, answer, { getTenant, config, bot }
|
|
|
432
395
|
|
|
433
396
|
switch (value) {
|
|
434
397
|
case 'title': await stepTitle(ctx, userId); break;
|
|
435
|
-
case 'time':
|
|
398
|
+
case 'time': await stepTime(ctx, userId, config); break;
|
|
436
399
|
case 'cron': await stepCron(ctx, userId); break;
|
|
437
400
|
case 'desc': await stepDescription(ctx, userId); break;
|
|
438
401
|
case 'instr': await stepInstructions(ctx, userId); break;
|
|
@@ -458,23 +421,7 @@ async function handleSchedText(ctx, text, { getTenant, config, bot }) {
|
|
|
458
421
|
|
|
459
422
|
if (field === 'title') {
|
|
460
423
|
draft.title = text.substring(0, 200);
|
|
461
|
-
ctx
|
|
462
|
-
await stepTime(ctx, userId);
|
|
463
|
-
return;
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
if (field === 'timezone') {
|
|
467
|
-
try {
|
|
468
|
-
Intl.DateTimeFormat(undefined, { timeZone: text.trim() });
|
|
469
|
-
draft.timezone = text.trim();
|
|
470
|
-
const msg = await ctx.reply(`Timezone set to ${draft.timezone}. Now enter the date/time.`);
|
|
471
|
-
trackMsg(userId, msg.chat.id, msg.message_id);
|
|
472
|
-
setPendingInput(userId, 'time', TIME_TTL_MS);
|
|
473
|
-
} catch {
|
|
474
|
-
const msg = await ctx.reply('Invalid timezone. Try again (e.g. Europe/Brussels, America/New_York):');
|
|
475
|
-
trackMsg(userId, msg.chat.id, msg.message_id);
|
|
476
|
-
setPendingInput(userId, 'timezone', TIME_TTL_MS);
|
|
477
|
-
}
|
|
424
|
+
await stepTime(ctx, userId, config);
|
|
478
425
|
return;
|
|
479
426
|
}
|
|
480
427
|
|