Relay provenance, cross-relay ranking, passages fan-out, find_community #2
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/relay-provenance-ranking"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Added
resolve_authorcandidates includepicture.relay; naddrs are encoded with the source relay as hint;addressable events are deduplicated across relays (newest wins).
title/description match),
limitafter the merge, zero-match hitslast (never dropped); new
lexicalfield.index (not just the first) and merges the hits, sorted by score desc,
before the per-document cap and
limit; newrelaysSearchedandrelaysIncomplete(relays whose indexer rejected the request) fields,alongside the existing
relaySearched(kept for compatibility). EachmetadataOnlyMatchesnaddr hints the relay its hit actually came from.search_calendar_eventsreturns NIP-52 time semantics the model no longerhas to know:
effectiveEnd(Unix seconds when the event is over — anend-less 31923 ends at its start, an end-less 31922 is a one-day event,
an
endat or beforestartcounts as missing),allDay,lastDay(theinclusive last day of an all-day event), and
endTzidinherited fromstartTzid.exposed as
attributes(registrationRequired,pricewithfree,attendanceMode,educationalLevelwith labels), plusnamedParticipants(
participanttags) andcommunities(htags), and filterable with thenew
free,registrationRequired,attendanceModeandeducationalLevelparameters (relay facets on nope-relay's calendar collection).
author{pubkey, name, bot}from therelay's kind-0 index (NIP-24
botmarks mirrors and crawlers), cached perauthor for 10 minutes.
search_calendar_eventscovers all four NIP-52 kinds:kinds: [31924]returns calendars (
calendars: title, description,eventRefs) andkinds: [31925]RSVPs (rsvps: status,freeBusy— dropped whendeclined,
eventRef,eventId,eventAuthor, note); an RSVP without avalid status is ignored. New
references(#a) andparticipants(
#p) filters answer "who RSVP'd to event X", "which calendars list X"and "events naming participant Y". Events expose
calendarRefs, thekind-31924 calendars they ask to be included in.
Dday tags asdays; an RSVP whoseadoes notreference a 31922/31923 coordinate is ignored; an empty
eventAttendanceModeis no statement.find_communitytool: free-text matches a topic against Communikeycommunity definitions (kind 10222) by name/description (lexical score,
same ranking helper as search_content), for "welche Community beschäftigt
sich mit …" questions. Per the Communikey spec ("Communities = npubs"),
name/pictureare resolved from the community pubkey's own kind-0profile (one batched query alongside the 10222 list) —
descriptionisthe 10222's own override tag, falling back to the kind-0
about.Returns
{pubkey, npub, name, description, picture?, relay?}per match —pubkeycan be passed as thecommunityparameter ofsearch_content/search_calendar_events. Reads from the newCOMMUNITY_RELAYSenv var (comma-separated; unset disables the tool), a5-minute in-memory stale-while-revalidate cache per process.
Fixed
calendar-attributes.jsexactly: the first VALID tag of a name wins (an invalid one no longer
shadows a later valid one), the attendance mode is trimmed and read by
its last path segment, an empty
educationalLevel:idis skipped, and anempty
titlefalls back to the deprecatedname.#glocallyas an exact match while the relay answers it as a prefix, so only events
whose geohash equalled the queried prefix survived.
#gis now relay-only.CALENDAR_HIDDEN_PUBKEYS(hex, npub or kind-30000 naddr entries, as inedufeed-app) hides bulk calendar sources from
search_calendar_eventsbydefault; the response reports
hiddenSourcesandincludeHiddenSources: truereturns them. Abotflag alone hides nothing.Changed
license:idtags of a learning resource(falling back to the plain
licensetag) and follows the sharedamb-mcp/amb-indexer contract: DINI AG KIM license-type concepts
(
https://w3id.org/kim/license/…) are composed as a set into a CC variant(e.g. LEHRE LADEN
[attribution, shareAlike]→BY-SA (KIM), open;[attribution, nonCommercial]→BY-NC (KIM), cc;noLicense→ other),and GPL/LGPL/AGPL/GFDL/MIT/Apache-2.0/BSD URIs are now
open(fullaccess) instead of
unknown. The de.wikipedia "Urheberrecht (Deutschland)"marker is labelled "Alle Rechte vorbehalten" (still metadata-only). A CC
URI on the event still takes precedence.
licenseFilter: "open"/"cc-any",accessLevelandget_resource'sopenLicensefollow suit;the relay-side
license.idprefilter lists include the KIM terms and thestored free-licence spellings.
Live check
Live run against
wss://amb-relay.edufeed.org+wss://oersi.edufeed.org+wss://sodix.edufeed.org(search_content) andwss://relay.edufeed.org(find_community), viascripts/rank-eval.ts. Both acceptance checks pass — top-1 matches the expected result for each:@Fortbildung_ReligionNo change to
rank.tswas needed — both brief-mandated first-place checks already passed.Deploy note
COMMUNITY_RELAYS=wss://relay.edufeed.orgmust be set on the instances that should exposefind_community; nothing else changes without it.🤖 Generated with Claude Code
Communikey community definitions, free-text matched by name/description (lexical score, same helper as search_content). Returns {pubkey, npub, name, description, picture?, relay?} per match; pubkey can be passed as the community parameter of search_content/search_calendar_events. Wired behind the new COMMUNITY_RELAYS env var (comma list, unset = tool absent); registerTools registers find_community only when a communityClient is passed. In-memory cache per process, 5 min, stale-while-revalidate. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>The brief had find_community read name/picture straight off the kind 10222 tags, but per the Communikey spec ("Communities = npubs") those live on the community pubkey's own kind-0 profile — the same resolution edufeed-app does with useProfileMap over community pubkeys. No live 10222 event carries name/picture tags either. parseCommunity(event, profileEvent?) now takes the optional kind-0 alongside the 10222: name = display_name || name (npub fallback unchanged), picture = kind-0 picture, description = the 10222's own override tag falling back to kind-0 about. fetchCommunities batches one kind-0 query for all community pubkeys per cache refresh (newest profile per pubkey wins), so a cache hit still makes zero further queryEvents calls and a refresh makes exactly two. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>Runs search_content for the five brief queries over amb-relay + oersi + sodix, and find_community for "e-teaching"/"Religion" when COMMUNITY_RELAYS is set. Live check passed both acceptance criteria ("Vorkurs Mathematik 11 Stochastik" first for "Statistik Vorkurs", "e-teaching.org" first for "e-teaching") — no rank.ts change needed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>Non-string profile fields are ignored (a {"name":42} no longer throws in tokenize and poisons the cache); 2-char all-caps tokens (KI, VR, IT) are kept for matching; relaysIncomplete/warning name relays that did not finish. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>