CitationOrigin
@forge/monorepo / backend/src / CitationOrigin
Type Alias: CitationOrigin
CitationOrigin = {
chunkId:string;chunkIndex:number;kind:"retrieval";locator?:string;sourceId:string;sourceType:"file"|"artifact"|"message"|"external"; } | {kind:"web";title?:string;url:string; }
Defined in: backend/src/core/content-parts.ts:180
Where a cited passage came from (#137).
A closed union with exactly two arms, and one shape for both is AC-6: the frontend renders one thing whether a claim came from an indexed document or from the web. Two part types would mean two renderers, two schemas, and eventually two behaviours for "click the citation".
The arms differ in what resolving means — a chunk id resolves inside this platform, a URL resolves outside it — and that difference is real, so it is a discriminant rather than a pile of optional fields.
Union Members
Type Literal
{ chunkId: string; chunkIndex: number; kind: "retrieval"; locator?: string; sourceId: string; sourceType: "file" | "artifact" | "message" | "external"; }
chunkId
readonlychunkId:string
The chunk, which is what makes AC-2's "specific passage" resolvable rather than aspirational.
chunkIndex
readonlychunkIndex:number
kind
readonlykind:"retrieval"
locator?
readonlyoptionallocator?:string
The heading path the chunker found, when there was one.
sourceId
readonlysourceId:string
sourceType
readonlysourceType:"file"|"artifact"|"message"|"external"
Type Literal
{ kind: "web"; title?: string; url: string; }
kind
readonlykind:"web"
title?
readonlyoptionaltitle?:string
url
readonlyurl:string
The URL that was actually read, after redirects — not the one requested.
A citation must open what was read. ShareFlow's safefetch exists because the two differ: a public URL
can redirect somewhere else entirely, and citing the request would cite a page nobody looked at.