@inquiryon/openclaw-amp-governance 1.0.7 → 1.0.9
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/index.js +8 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -126,9 +126,10 @@ async function ampLog(instanceId, message, level = 'INFO') {
|
|
|
126
126
|
*/
|
|
127
127
|
async function notifyUser(sender, message) {
|
|
128
128
|
if (!sender?.from || !_runtime) return;
|
|
129
|
+
const prefixed = `[AMP]\n${message}`;
|
|
129
130
|
console.log(`[AMP Governance] Sending notification to ${sender.from}: ${message}`);
|
|
130
131
|
try {
|
|
131
|
-
await _runtime.channel.whatsapp.sendMessageWhatsApp(sender.from,
|
|
132
|
+
await _runtime.channel.whatsapp.sendMessageWhatsApp(sender.from, prefixed, { verbose: false });
|
|
132
133
|
} catch (err) {
|
|
133
134
|
console.warn('[AMP Governance] notifyUser failed:', err.message);
|
|
134
135
|
}
|
|
@@ -391,6 +392,12 @@ export default {
|
|
|
391
392
|
api.logger.info('AMP Governance registered. Phase 4 - eval policy enforcement active.');
|
|
392
393
|
_runtime = api.runtime;
|
|
393
394
|
|
|
395
|
+
// ── SESSION RESET: clear instance cache on /new or /reset ────────────────
|
|
396
|
+
api.on('session_start', () => {
|
|
397
|
+
console.log('[AMP Governance] Session started — clearing instance cache.');
|
|
398
|
+
_instanceId = null;
|
|
399
|
+
});
|
|
400
|
+
|
|
394
401
|
// ── INBOUND MESSAGE: cache sender for HITL notifications ─────────────────
|
|
395
402
|
api.on('message_received', (event, ctx) => {
|
|
396
403
|
if (event.from && ctx.channelId) {
|