@agentvault/agentvault 0.19.47 → 0.19.48

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.
@@ -49291,6 +49291,15 @@ async function handleInbound(params) {
49291
49291
  }
49292
49292
  }
49293
49293
  const plaintext = isRoomMessage ? _stripMentions(rawPlaintext, account.agentName ?? "", account.accountId ?? "") : rawPlaintext;
49294
+ if (isRoomMessage || isA2AMessage) {
49295
+ try {
49296
+ const woke = await requestHeartbeatNow({ reason: `AgentVault ${isRoomMessage ? "room" : "A2A"} message received` });
49297
+ if (woke) {
49298
+ console.log(`[AgentVault] Heartbeat triggered for ${isRoomMessage ? "room" : "A2A"} message`);
49299
+ }
49300
+ } catch {
49301
+ }
49302
+ }
49294
49303
  const startTime = Date.now();
49295
49304
  const traceId = randomBytes(16).toString("hex");
49296
49305
  const rootSpanId = randomBytes(8).toString("hex");
@@ -50351,6 +50360,59 @@ var openclaw_entry_default = {
50351
50360
  } catch {
50352
50361
  }
50353
50362
  });
50363
+ api.on("before_tool_call", async (event) => {
50364
+ try {
50365
+ const toolName = event?.toolName;
50366
+ const agentId = event?.agentId;
50367
+ if (!toolName || !_channels.size) return {};
50368
+ for (const [, ch] of _channels) {
50369
+ const enforcer = ch?._policyEnforcer;
50370
+ if (!enforcer) continue;
50371
+ for (const [skillName] of enforcer.skills ?? []) {
50372
+ const result = enforcer.evaluate({ skillName, toolName, agentId });
50373
+ if (result && !result.allowed) {
50374
+ console.log(`[AgentVault] Tool "${toolName}" denied by policy \u2014 requesting approval`);
50375
+ const reason = result.violations?.[0]?.message ?? "";
50376
+ return {
50377
+ requireApproval: true,
50378
+ approvalReason: `AgentVault policy: tool "${toolName}" requires owner approval. ${reason}`.trim()
50379
+ };
50380
+ }
50381
+ }
50382
+ }
50383
+ return {};
50384
+ } catch {
50385
+ return {};
50386
+ }
50387
+ });
50388
+ api.on("before_dispatch", async (event) => {
50389
+ try {
50390
+ const senderHub = event?.inbound?.metadata?.senderHubAddress;
50391
+ if (!senderHub || !_channels.size) return;
50392
+ for (const [, ch] of _channels) {
50393
+ const apiUrl = ch?.config?.apiUrl;
50394
+ if (!apiUrl) continue;
50395
+ try {
50396
+ const res = await fetch(`${apiUrl}/api/v1/hub/verify/${senderHub}`);
50397
+ if (res.ok) {
50398
+ const trust = await res.json();
50399
+ if (event.inbound.metadata) {
50400
+ event.inbound.metadata._avTrustContext = {
50401
+ senderHub,
50402
+ trustTier: trust.trust_tier,
50403
+ verified: trust.verified,
50404
+ certificationStatus: trust.certification_status
50405
+ };
50406
+ }
50407
+ console.log(`[AgentVault] Injected trust context for ${senderHub}: ${trust.trust_tier}`);
50408
+ }
50409
+ } catch {
50410
+ }
50411
+ break;
50412
+ }
50413
+ } catch {
50414
+ }
50415
+ });
50354
50416
  }
50355
50417
  Promise.resolve().then(() => (init_openclaw_compat(), openclaw_compat_exports)).then(async ({ onAgentEvent: onAgentEvent2, onSessionTranscriptUpdate: onSessionTranscriptUpdate2 }) => {
50356
50418
  onAgentEvent2((event) => {