@inetafrica/open-claudia 2.6.1 ā 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/core/runner.js +9 -0
- package/core/system-prompt.js +14 -1
- package/package.json +1 -1
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