MCPcopy
hub / github.com/rohitg00/agentmemory / recordAudit

Function recordAudit

src/functions/audit.ts:34–55  ·  view source on GitHub ↗
(
  kv: StateKV,
  operation: AuditEntry["operation"],
  functionId: string,
  targetIds: string[],
  details: Record<string, unknown> = {},
  qualityScore?: number,
  userId?: string,
)

Source from the content-addressed store, hash-verified

32// BEFORE kv.delete(...) and match one of the two shapes above.
33
34export async function recordAudit(
35 kv: StateKV,
36 operation: AuditEntry["operation"],
37 functionId: string,
38 targetIds: string[],
39 details: Record<string, unknown> = {},
40 qualityScore?: number,
41 userId?: string,
42): Promise<AuditEntry> {
43 const entry: AuditEntry = {
44 id: generateId("aud"),
45 timestamp: new Date().toISOString(),
46 operation,
47 userId,
48 functionId,
49 targetIds,
50 details,
51 qualityScore,
52 };
53 await kv.set(KV.audit, entry.id, entry);
54 return entry;
55}
56
57export async function safeAudit(
58 kv: StateKV,

Calls 2

generateIdFunction · 0.85
setMethod · 0.45

Tested by

no test coverage detected