chore(ai): event schema validation tool + fixes

- Created `scripts/agent/validate-events.mjs` to verify all event builders produce valid events against the schema.
- Instrumented `js/nostr/nip71.js` to validate NIP-71 events during construction (other builders in `js/nostrEventSchemas.js` were already instrumented).
- Validated all 25 event types using the new tool.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-30 05:34:50 +00:00
1 parent 73c705831b
commit 39c4e2249d
2 files changed
+258 -248

No files matched your search

+12 -1
View File
@@ -6,6 +6,10 @@ import {
resolveInfoJsonUrl,
} from "../utils/storagePointer.js";
import { getCachedNostrTools } from "./toolkit.js";
import {
validateEventAgainstSchema,
NOTE_TYPES,
} from "../nostrEventSchemas.js";
function stringFromInput(value) {
if (value === null || value === undefined) {
@@ -934,13 +938,20 @@ export function buildNip71VideoEvent({
tags.push(...pointerTags);
}
return {
const event = {
kind: normalizeNip71Kind(metadata.kind),
pubkey: normalizedPubkey,
created_at: timestamp,
tags,
content: summary,
};
validateEventAgainstSchema(
event.kind === 22 ? NOTE_TYPES.NIP71_SHORT_VIDEO : NOTE_TYPES.NIP71_VIDEO,
event,
);
return event;
}
export function collectNip71PointerRequests(videos = []) {