@vectorize-io/hindsight-openclaw 0.4.10 → 0.4.11
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/dist/index.js +16 -0
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -217,6 +217,7 @@ function getPluginConfig(api) {
|
|
|
217
217
|
// Dynamic bank ID options (default: enabled)
|
|
218
218
|
dynamicBankId: config.dynamicBankId !== false,
|
|
219
219
|
bankIdPrefix: config.bankIdPrefix,
|
|
220
|
+
excludeProviders: Array.isArray(config.excludeProviders) ? config.excludeProviders : [],
|
|
220
221
|
};
|
|
221
222
|
}
|
|
222
223
|
export default function (api) {
|
|
@@ -443,6 +444,11 @@ export default function (api) {
|
|
|
443
444
|
currentSessionKey = ctx.sessionKey;
|
|
444
445
|
}
|
|
445
446
|
currentAgentContext = ctx;
|
|
447
|
+
// Check if this provider is excluded
|
|
448
|
+
if (ctx?.messageProvider && pluginConfig.excludeProviders?.includes(ctx.messageProvider)) {
|
|
449
|
+
console.log(`[Hindsight] Skipping recall for excluded provider: ${ctx.messageProvider}`);
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
446
452
|
// Derive bank ID from context
|
|
447
453
|
const bankId = deriveBankId(ctx, pluginConfig);
|
|
448
454
|
console.log(`[Hindsight] before_agent_start - bank: ${bankId}, channel: ${ctx?.messageProvider}/${ctx?.channelId}`);
|
|
@@ -517,6 +523,11 @@ User message: ${prompt}
|
|
|
517
523
|
try {
|
|
518
524
|
// Use context from this hook, or fall back to context captured in before_agent_start
|
|
519
525
|
const effectiveCtx = ctx || currentAgentContext;
|
|
526
|
+
// Check if this provider is excluded
|
|
527
|
+
if (effectiveCtx?.messageProvider && pluginConfig.excludeProviders?.includes(effectiveCtx.messageProvider)) {
|
|
528
|
+
console.log(`[Hindsight] Skipping retain for excluded provider: ${effectiveCtx.messageProvider}`);
|
|
529
|
+
return;
|
|
530
|
+
}
|
|
520
531
|
// Derive bank ID from context
|
|
521
532
|
const bankId = deriveBankId(effectiveCtx, pluginConfig);
|
|
522
533
|
console.log(`[Hindsight Hook] agent_end triggered - bank: ${bankId}`);
|
|
@@ -553,6 +564,11 @@ User message: ${prompt}
|
|
|
553
564
|
.map((block) => block.text)
|
|
554
565
|
.join('\n');
|
|
555
566
|
}
|
|
567
|
+
// Strip plugin-injected memory tags to prevent feedback loop
|
|
568
|
+
// Remove <hindsight_memories> blocks injected during before_agent_start
|
|
569
|
+
content = content.replace(/<hindsight_memories>[\s\S]*?<\/hindsight_memories>/g, '');
|
|
570
|
+
// Remove any <relevant_memories> blocks (legacy/alternative format)
|
|
571
|
+
content = content.replace(/<relevant_memories>[\s\S]*?<\/relevant_memories>/g, '');
|
|
556
572
|
return `[role: ${role}]\n${content}\n[${role}:end]`;
|
|
557
573
|
})
|
|
558
574
|
.join('\n\n');
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED