import { z } from 'zod'; /** * Zod schemas mirroring the canonical Standard.site lexicons that Sifa * consumes when rendering publication embeds. * * Canonical lexicons live at: * DID: did:plc:re3ebnp5v7ffagz6rb6xfei4 * PDS: https://auriporia.us-west.host.bsky.network * Collection: com.atproto.lexicon.schema * * Sifa does NOT own these lexicons; we vendor the validation shapes so * clients can parse augmented embeds and (in Phase 4) write subscription * records to viewers' PDSes. Re-check against the canonical PDS on each * SDK release to detect schema drift. */ declare const rgbColorSchema: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; type RgbColor = z.infer; /** site.standard.theme.basic */ declare const BasicThemeSchema: z.ZodObject<{ background: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; foreground: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; accent: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; accentForeground: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>; type BasicTheme = z.infer; /** site.standard.publication */ declare const StandardSitePublicationRecordSchema: z.ZodObject<{ url: z.ZodString; name: z.ZodString; description: z.ZodOptional; icon: z.ZodOptional; ref: z.ZodUnknown; mimeType: z.ZodOptional; size: z.ZodOptional; }, z.core.$loose>>; basicTheme: z.ZodOptional; foreground: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; accent: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; accentForeground: z.ZodObject<{ r: z.ZodNumber; g: z.ZodNumber; b: z.ZodNumber; }, z.core.$strip>; }, z.core.$strip>>; labels: z.ZodOptional>; values: z.ZodArray>; }, z.core.$strip>>; preferences: z.ZodOptional>; }, z.core.$strip>>; }, z.core.$loose>; type StandardSitePublicationRecord = z.infer; /** site.standard.document */ declare const StandardSiteDocumentRecordSchema: z.ZodObject<{ site: z.ZodString; title: z.ZodString; path: z.ZodOptional; publishedAt: z.ZodString; updatedAt: z.ZodOptional; description: z.ZodOptional; textContent: z.ZodOptional; tags: z.ZodOptional>; coverImage: z.ZodOptional; ref: z.ZodUnknown; mimeType: z.ZodOptional; size: z.ZodOptional; }, z.core.$loose>>; contributors: z.ZodOptional; displayName: z.ZodOptional; }, z.core.$loose>>>; bskyPostRef: z.ZodOptional>; labels: z.ZodOptional>; values: z.ZodArray>; }, z.core.$strip>>; }, z.core.$loose>; type StandardSiteDocumentRecord = z.infer; /** * site.standard.graph.subscription * * Authored by a viewer to declare a subscription to a publication. Used * by Phase 4 inline-subscribe path. Record key is a TID; the AT-URI * shape is `at:///site.standard.graph.subscription/`. */ declare const StandardSiteSubscriptionRecordSchema: z.ZodObject<{ publication: z.ZodString; createdAt: z.ZodOptional; }, z.core.$strip>; type StandardSiteSubscriptionRecord = z.infer; /** * site.standard.graph.recommend * * Document-level "like" record. Same scope as subscription via the * site.standard.authSocial OAuth permission-set, so Phase 4 unlocks * inline likes alongside inline subscribes. */ declare const StandardSiteRecommendRecordSchema: z.ZodObject<{ document: z.ZodString; createdAt: z.ZodString; }, z.core.$strip>; type StandardSiteRecommendRecord = z.infer; /** * Publisher allowlist for the Standard.site rich embed. * * Mirrors `bluesky-social/social-app` * `src/components/Post/Embed/StandardSiteEmbed/publishers.ts`. The only * gate this provides is which publishers get the highlighted * "Subscribe on {Publisher}" CTA with a publisher icon vs the plain * "View publication" fallback — any Standard.site embed renders * regardless of allowlist membership. * * Sync policy: review additions against the upstream bsky list weekly; * Singi Labs reviews before merge. */ interface Publisher { /** Lowercase host. Subdomains are matched via `hostMatches`. */ host: string; /** Human-facing publisher name shown in CTA copy. */ name: string; /** * Stable identifier used by clients to look up brand icons. The SDK * does not ship icon assets — sifa-web maintains them keyed by this * id so React Native vs web rendering can diverge. */ iconKey: 'leaflet' | 'pckt' | 'offprint'; } declare const STANDARD_SITE_PUBLISHERS: readonly Publisher[]; /** * Returns true when `host` exactly matches `target` or is a subdomain of * it. Hosts are expected to be lowercase already. */ declare function hostMatches(host: string, target: string): boolean; /** * Match a publisher by host. Returns the publisher when `host` is on the * allowlist (exact or subdomain match), null otherwise. Host should be * lowercase. */ declare function matchPublisherByHost(host: string | null | undefined): Publisher | null; /** * Match a publisher by URI. Convenience wrapper around * `matchPublisherByHost` for callers that have a publication URL handy. */ declare function matchPublisherByUri(uri: string | undefined | null): Publisher | null; /** * Linkblog-share detection for the Standard.site document family. * * A "linkblog" (e.g. Skyreader) writes a `site.standard.document` to the * user's PDS for every *external* article they share. Those documents are * valid Standard.site posts, so they surface in Sifa's activity stream and * profile portfolio as if the user authored them — but the user only shared * someone else's writing (sifa-workspace#351). * * These predicates identify such shares so callers can exclude them, while * leaving genuinely authored Standard.site posts (Leaflet, pckt, Offprint * essays) untouched. * * Signals, most to least reliable: * 1. The Skyreader provenance marker on the document (`skyreaderLinkblog`). * 2. The document's parent publication is itself a linkblog (the marker * lives on the publication even when older documents lack their own). * Callers resolve the publication and pass `publicationIsLinkblog`. * 3. A `links` entry with `rel: "repost"` — a quote-reshare, inherently * not the user's own writing. * 4. Heuristic: a `links` entry with `rel: "related"` pointing to an * external host different from the document's own publication host — * the document's subject is an off-site article. Only applied when the * caller supplies the resolved `publicationHost`, so an authored post * that merely cites an external resource is never hidden on a guess. */ /** * Discovery marker Skyreader stamps on every linkblog publication and on * link-share documents. Value is a fixed URL, not a per-user value. */ declare const SKYREADER_LINKBLOG_MARKER_URL = "https://skyreader.app/linkblog"; /** * True when a `site.standard.publication` record is a linkblog rather than an * authored publication — i.e. it carries the Skyreader provenance marker. */ declare function isLinkblogPublication(record: unknown): boolean; interface LinkblogShareOptions { /** * True when the document's parent publication has been resolved and is * itself a linkblog (see {@link isLinkblogPublication}). Catches shares * whose document predates the per-document marker. */ publicationIsLinkblog?: boolean; /** * Resolved host of the document's parent publication, enabling the * external-subject heuristic. Omit when the publication (hence its host) * could not be resolved — the heuristic then stays off. */ publicationHost?: string; } /** * True when a `site.standard.document` is a shared/linkblogged external * article rather than the user's own writing. See the module comment for the * signal order. */ declare function isLinkblogShareDocument(record: unknown, opts?: LinkblogShareOptions): boolean; /** * Publication metadata embedded in the augmented activity view by * sifa-api when an external link card matches an indexed publication. * * `uri` is the publication's AT-URI (e.g. * `at://did:plc:abc/site.standard.publication/xyz`). `theme` carries * the publication's own colors when supplied — clients should apply a * WCAG min-contrast fallback before honoring them. * * `icon` is left as `unknown` here because its representation depends * on the surface: blob ref on the wire, CDN URL after resolution. */ interface PublicationSource { uri: string; title: string; icon?: unknown; theme?: BasicTheme; } /** * Shape attached to activity items whose external link card URL matches * a Standard.site record. Mirrors the relevant fields of bsky's * `StandardSiteEmbed` view so a sifa-web renderer can be near-1:1. * * `associatedRefs` carries AT-URIs the client may use in Phase 4 to * query subscription state for the viewer. */ interface StandardSiteEmbedView { uri: string; source: PublicationSource; associatedRefs: { uri: string; }[]; createdAt?: string; readingTime?: number; } declare const STANDARD_SITE_PUBLICATION_NSID: "site.standard.publication"; declare const STANDARD_SITE_DOCUMENT_NSID: "site.standard.document"; declare const STANDARD_SITE_SUBSCRIPTION_NSID: "site.standard.graph.subscription"; declare const STANDARD_SITE_RECOMMEND_NSID: "site.standard.graph.recommend"; /** * Pre-defined OAuth permission-set the consumer apps request to write * subscription + recommend records on behalf of the viewer. The actual * permission-set is published under * `at://did:plc:re3ebnp5v7ffagz6rb6xfei4/com.atproto.lexicon.schema/site.standard.authSocial`. */ declare const STANDARD_SITE_AUTH_SOCIAL_NSID: "site.standard.authSocial"; /** * True when the AT-URI's collection segment is a Standard.site * collection. Useful for detecting Standard.site embed augmentation on * arbitrary activity items. */ declare function isStandardSiteAtUri(uri: string): boolean; /** * True when any `associatedRefs[].uri` is a Standard.site collection * AT-URI. The bsky client uses the same check to gate the * `StandardSiteEmbed` renderer. */ declare function hasStandardSiteAssociatedRef(refs: { uri: string; }[] | undefined): boolean; export { type BasicTheme, BasicThemeSchema, type LinkblogShareOptions, type PublicationSource, type Publisher, type RgbColor, SKYREADER_LINKBLOG_MARKER_URL, STANDARD_SITE_AUTH_SOCIAL_NSID, STANDARD_SITE_DOCUMENT_NSID, STANDARD_SITE_PUBLICATION_NSID, STANDARD_SITE_PUBLISHERS, STANDARD_SITE_RECOMMEND_NSID, STANDARD_SITE_SUBSCRIPTION_NSID, type StandardSiteDocumentRecord, StandardSiteDocumentRecordSchema, type StandardSiteEmbedView, type StandardSitePublicationRecord, StandardSitePublicationRecordSchema, type StandardSiteRecommendRecord, StandardSiteRecommendRecordSchema, type StandardSiteSubscriptionRecord, StandardSiteSubscriptionRecordSchema, hasStandardSiteAssociatedRef, hostMatches, isLinkblogPublication, isLinkblogShareDocument, isStandardSiteAtUri, matchPublisherByHost, matchPublisherByUri };