@inetafrica/open-claudia 2.6.0 → 2.6.2
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 +3 -0
- package/core/router.js +5 -4
- package/core/runner.js +9 -0
- package/core/system-prompt.js +14 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v2.6.1
|
|
4
|
+
- **Fix: replying to a bot message now carries the quoted context.** Since v2.0.0 the router skipped reply context when the replied-to message came from the bot itself (assuming it was already in conversation context) — which silently dropped the link whenever that message was old or compacted away. Reply context is now always injected, labelled with provenance ("your earlier assistant message" vs "this message").
|
|
5
|
+
|
|
3
6
|
## v2.6.0
|
|
4
7
|
- **Dream: nightly memory consolidation (Phase 3 of the memory system).** A quiet-hours pass (`core/dream.js`, default 4am via `DREAM_CRON`, model `DREAM_MODEL` default sonnet, `DREAM=off` to disable) reviews the entire pack + entity memory on a stronger model and returns a strict-JSON decision that bot code applies:
|
|
5
8
|
- **Merges** packs that drifted into the same topic (sections synthesised, not concatenated) — merged-away packs are backed up to `~/.open-claudia/backup/dream-<stamp>/` before removal.
|
package/core/router.js
CHANGED
|
@@ -324,9 +324,7 @@ async function handleText(envelope) {
|
|
|
324
324
|
|
|
325
325
|
let prompt = text;
|
|
326
326
|
const reply = envelope.reply;
|
|
327
|
-
|
|
328
|
-
const skipReplyContext = replyFromBot && !reply.document && !reply.photo;
|
|
329
|
-
if (reply && !skipReplyContext) {
|
|
327
|
+
if (reply) {
|
|
330
328
|
let ctx = "";
|
|
331
329
|
if (reply.text) ctx = reply.text;
|
|
332
330
|
if (reply.caption) ctx += (ctx ? "\n" : "") + reply.caption;
|
|
@@ -353,7 +351,10 @@ async function handleText(envelope) {
|
|
|
353
351
|
}
|
|
354
352
|
}
|
|
355
353
|
if (reply.photo) ctx += (ctx ? "\n" : "") + "[Attached photo]";
|
|
356
|
-
if (ctx)
|
|
354
|
+
if (ctx) {
|
|
355
|
+
const who = reply.from?.is_bot ? "your earlier assistant message" : "this message";
|
|
356
|
+
prompt = `Replying to ${who}:\n---\n${ctx.length > 1000 ? ctx.slice(0, 1000) + "..." : ctx}\n---\n\n${text}`;
|
|
357
|
+
}
|
|
357
358
|
}
|
|
358
359
|
|
|
359
360
|
await runClaude(prompt, state.currentSession.dir, envelope.messageId);
|
package/core/runner.js
CHANGED
|
@@ -647,6 +647,15 @@ async function runClaude(prompt, cwd, replyToMsgId, opts = {}) {
|
|
|
647
647
|
};
|
|
648
648
|
|
|
649
649
|
const args = buildClaudeArgs(prompt, opts);
|
|
650
|
+
// Recall announcements: mirror the write-side "🧠 jotted down" notes with
|
|
651
|
+
// a read-side line whenever packs/entities freshly enter context this turn.
|
|
652
|
+
try {
|
|
653
|
+
const { packs, entities } = require("./system-prompt").consumeLastInjected();
|
|
654
|
+
const recalled = [...packs, ...entities];
|
|
655
|
+
if (recalled.length > 0) {
|
|
656
|
+
chatContext.run(store, () => send(`📖 Recalled my notes on: ${recalled.join(", ")}`).catch(() => {}));
|
|
657
|
+
}
|
|
658
|
+
} catch (e) { /* announcements are best-effort */ }
|
|
650
659
|
const binaryPath = getActiveBinary();
|
|
651
660
|
const proc = spawn(binaryPath, args, {
|
|
652
661
|
cwd,
|
package/core/system-prompt.js
CHANGED
|
@@ -278,6 +278,16 @@ function buildDynamicContextBlock() {
|
|
|
278
278
|
const packsInjectedFor = new Map(); // `${adapterId}:${channelId}:${dir}` -> `${sessionId}:${updated}`
|
|
279
279
|
const PACK_INJECT_MAX_CHARS = 4000;
|
|
280
280
|
|
|
281
|
+
// What the last promptWithDynamicContext call freshly injected (not the
|
|
282
|
+
// deduped repeats) — consumed by the runner to announce recalls in chat,
|
|
283
|
+
// mirroring the write-side announcements.
|
|
284
|
+
let lastInjected = { packs: [], entities: [] };
|
|
285
|
+
function consumeLastInjected() {
|
|
286
|
+
const out = lastInjected;
|
|
287
|
+
lastInjected = { packs: [], entities: [] };
|
|
288
|
+
return out;
|
|
289
|
+
}
|
|
290
|
+
|
|
281
291
|
function formatPackForContext(pack, packsLib) {
|
|
282
292
|
const clip = (s, n) => (s.length > n ? s.slice(0, n) + "\n…[truncated — read the full pack file]" : s);
|
|
283
293
|
const parts = [`### Pack: ${pack.name} (${pack.dir})`];
|
|
@@ -319,6 +329,7 @@ function buildPackBlock(prompt) {
|
|
|
319
329
|
const stamp = `${sess}:${pack.updated}`;
|
|
320
330
|
if (packsInjectedFor.get(key) === stamp) continue;
|
|
321
331
|
packsInjectedFor.set(key, stamp);
|
|
332
|
+
lastInjected.packs.push(pack.name || m.dir);
|
|
322
333
|
blocks.push(formatPackForContext(pack, packsLib));
|
|
323
334
|
}
|
|
324
335
|
if (used.length > 0) setImmediate(() => { try { packsLib.touchUsed(used); } catch (e) {} });
|
|
@@ -365,6 +376,7 @@ function buildEntityBlock(prompt) {
|
|
|
365
376
|
const stamp = `${sess}:${ent.updated}`;
|
|
366
377
|
if (entitiesInjectedFor.get(key) === stamp) continue;
|
|
367
378
|
entitiesInjectedFor.set(key, stamp);
|
|
379
|
+
lastInjected.entities.push(ent.name || m.slug);
|
|
368
380
|
blocks.push(formatEntityForContext(ent));
|
|
369
381
|
}
|
|
370
382
|
if (seen.length > 0) setImmediate(() => { try { entitiesLib.touchSeen(seen); } catch (e) {} });
|
|
@@ -376,6 +388,7 @@ function buildEntityBlock(prompt) {
|
|
|
376
388
|
}
|
|
377
389
|
|
|
378
390
|
function promptWithDynamicContext(prompt) {
|
|
391
|
+
lastInjected = { packs: [], entities: [] };
|
|
379
392
|
try {
|
|
380
393
|
return `${buildDynamicContextBlock()}${buildPackBlock(prompt)}${buildEntityBlock(prompt)}\n\nCurrent user request:\n${prompt}`;
|
|
381
394
|
} catch (e) {
|
|
@@ -383,4 +396,4 @@ function promptWithDynamicContext(prompt) {
|
|
|
383
396
|
}
|
|
384
397
|
}
|
|
385
398
|
|
|
386
|
-
module.exports = { loadSoul, buildSystemPrompt, buildDynamicContextBlock, promptWithDynamicContext };
|
|
399
|
+
module.exports = { loadSoul, buildSystemPrompt, buildDynamicContextBlock, promptWithDynamicContext, consumeLastInjected };
|
package/package.json
CHANGED