/** * Code generated from shared/sparkletree/wire/contract.ts. DO NOT EDIT. * * Regenerate with `pnpm wire:generate` from the repo root. * Editing this file by hand puts the Go edge and the Next twin back on * separate contracts, which is the exact failure the SDK plan's decision (a) * spends a workstream preventing. */ export declare const PROTOCOL_VERSIONS: readonly [1, 2]; export type ProtocolVersion = (typeof PROTOCOL_VERSIONS)[number]; export declare const PROTOCOL_DEFAULT = 1; export declare const PROTOCOL_CURRENT = 2; export declare const PROTOCOL_PARAM = "st-protocol"; export declare const PROTOCOL_HEADER = "st-protocol"; export declare const PROTOCOL_RESPONSE_HEADER = "st-protocol"; /** * Is this a version we implement? Absent/blank resolves to PROTOCOL_DEFAULT * before it gets here. */ export declare function isSupportedProtocol(version: number): version is ProtocolVersion; /** * Resolve the negotiated version from a header value and a query param. * Header wins. Absent, blank, or unparseable resolves to PROTOCOL_DEFAULT — * never an error, because every shell stamped into a customer page before * negotiation existed sends nothing at all. */ export declare function resolveProtocol(header: string | null | undefined, param: string | null | undefined): number; export declare const COPY_MODES: readonly ["generate", "replay"]; export type CopyMode = (typeof COPY_MODES)[number]; export declare const CONTENT_SOURCES: readonly ["generated", "cached", "static"]; export type ContentSource = (typeof CONTENT_SOURCES)[number]; export declare const DEGRADE_REASONS: readonly ["quota", "spend-cap", "upstream", "timeout"]; export type DegradeReason = (typeof DEGRADE_REASONS)[number]; export declare const SERVED_LANGUAGE_REASONS: readonly ["english", "fixed", "fixed-default", "local-geo-locale", "local-geo-country", "local-browser-locale", "local-accept-language", "local-default", "language-check-fallback"]; export type ServedLanguageReason = (typeof SERVED_LANGUAGE_REASONS)[number]; export declare const PICK_REASON_CODES: readonly ["fit", "results", "exploration", "split", "cycle", "pinned", "only_option", "model", "fallback"]; export type PickReasonCode = (typeof PICK_REASON_CODES)[number]; export declare const INTENTS: readonly ["signup", "signin", "retain", "upsell", "reassure", "explain", "browse", "convert"]; export type Intent = (typeof INTENTS)[number]; export declare const FRAGMENT_KINDS: readonly ["headline", "body", "cta", "label", "empty-state"]; export type FragmentKind = (typeof FRAGMENT_KINDS)[number]; export declare const FRAGMENT_WARMTHS: readonly ["cold", "warming", "warm"]; export type FragmentWarmth = (typeof FRAGMENT_WARMTHS)[number]; export declare const SDK_PARAM = "sdk"; export declare const SDK_PARAM_VALUE = "1"; export declare const VARIANT_PARAM = "variant"; /** * Resolved creative theme: token values plus, for each token, where it came * from. */ export interface ThemePayload { /** * Token name → CSS color. The SDK theme engine writes these as custom * properties. */ colors: Record; /** * Token name → provenance (campaign, brand, context, default). Drives the * Ledger. */ sources: Record; } /** The best-fit design among the eligible designs that were not served. */ export interface PickRunnerUp { /** The runner-up design's variant id. */ variantId: string; /** Its name, as the studio shows it. */ variantName: string; /** Its fit for the moment, from -1 to 1, two decimals. */ fit: number; } /** * The moment design fit read, as cue keys. A field is absent when the * request did not place it. */ export interface PickMoment { /** season.winter | season.spring | season.summer | season.autumn. */ season?: string; /** weather.rain | weather.snow_ice | weather.clear. */ weather?: string; /** temp.cold | temp.mild | temp.warm | temp.hot. */ tempBand?: string; /** daypart.morning | daypart.daytime | daypart.evening | daypart.night. */ daypart?: string; } /** * Why the edge served this design. Only with a signed dashboard preview * grant (?st-preview=, minted for a signed-in user); never on a public * serve, never rendered to an end viewer. */ export interface PickReason { /** The step that chose the design. */ code: "fit" | "results" | "exploration" | "split" | "cycle" | "pinned" | "only_option" | "model" | "fallback"; /** * The served design's fit for the moment, from -1 to 1, two decimals. * Present when design fit applied to the serve. */ fit?: number; /** * Up to two cue keys the served design shows for the moment, strongest * first ("Shown because: winter, cold"). Present with fit. */ cues?: string[]; /** * The best fit among the other designs. Present with fit when two or more * designs were eligible. */ runnerUp?: PickRunnerUp; /** The moment fit read. Present with fit. */ moment?: PickMoment; } /** * Terminal metadata. Everything a client needs to attribute the impression * it is about to report. */ export interface DoneMeta { /** * Campaign actually served (may differ from the requested one after * surface resolution). */ campaignId: string; /** * Variant the ε-greedy resolver picked. Clients MUST pin this on every * subsequent call in the page view. */ variantId: string; /** Human label for the variant, for the Ledger and Studio. */ variantName?: string; /** * W5. Whether the copy in this stream was generated for this request, * replayed from cache, or stored static content. Trust chrome keys off * this. */ contentSource: "generated" | "cached" | "static"; /** * W8. Present only when the server fell back to deterministic static * serving. Absent means full service. */ degraded?: "quota" | "spend-cap" | "upstream" | "timeout"; /** * Context rules that actually changed the output. Empty array means * context was read but changed nothing. */ contextApplied?: string[]; /** Resolved CTA destination. */ ctaAction?: string; /** CTA behaviour class (link, modal, conversation…). */ ctaType?: string; /** QR/handoff target for physical surfaces. */ staticHandoffUrl?: string; /** * Conversational-ad config passthrough. Shape owned by the conversation * service. */ conversation?: unknown; /** * How the served campaign was chosen: an explicit variant pin, surface * resolution, or declared-context resolution. Absent means pinned on older * edges. */ resolvedFrom?: "pinned" | "surface" | "context"; /** * Canonical declared-context hash that participated in resolution. Feeds * attribution and the rung-3 promotion report. */ contextHash?: string; /** * BCP 47 tag of the language the copy was written for on this serve (e.g. * ja-JP). Clients copy it into context.servedLanguage of the impression * and click they report, so analytics can say which language each market * saw. Absent on older edges and on streams that served no campaign. */ servedLanguage?: string; /** Why the edge chose servedLanguage. Present whenever servedLanguage is. */ servedLanguageReason?: "english" | "fixed" | "fixed-default" | "local-geo-locale" | "local-geo-country" | "local-browser-locale" | "local-accept-language" | "local-default" | "language-check-fallback"; /** * Why the edge served this design. Only with a signed dashboard preview * grant (?st-preview=, minted for a signed-in user): absent on every * public serve. Never render it to an end viewer. */ pickReason?: PickReason; /** * Design fit of the served design (also in pickReason.fit). Only with a * signed dashboard preview grant, when design fit applied. */ fit?: number; /** The cues behind fit (also in pickReason.cues). Same audience as fit. */ fitCues?: string[]; } /** * Developer-declared placement. Untrusted input: every field is * length-capped and pattern-scrubbed server-side. Unknown keys are dropped * by contract, at both ends. */ export interface DeclaredContext { /** Declared page class, [a-z0-9-]{1,32}. Never a URL or path. */ page?: string; /** Platform intent vocabulary. Values outside the enum are dropped. */ intent?: "signup" | "signin" | "retain" | "upsell" | "reassure" | "explain" | "browse" | "convert"; /** * Placement descriptor, never a user identifier. ≤32 chars, ≤16 live * values per org. */ audience?: string; /** * Free text, ≤280 chars. HASHED IN FULL — a distinct notes value is a * distinct context and costs a mint. Reaches the prompt delimited as * untrusted. Never echoed to any client. */ notes?: string; } /** * One resolved fragment field. Provenance rules are identical to copy * fields: static copy may never wear the adaptation mark. */ export interface FragmentField { /** Final text, within the server-enforced length budget. */ text: string; /** W5 provenance. Static copy may never wear the mark. */ source: "generated" | "cached" | "static"; } /** * One field the caller declares on the mint verb: what kind of copy it is * and the developer fallback it must beat. */ export interface FragmentSchemaField { /** Caller-chosen field name. Keys the fragments map in the response. */ key: string; /** Field class. Selects the kind's length-budget floor. */ kind: "headline" | "body" | "cta" | "label" | "empty-state"; /** * Length budget. Server-recomputed as ceil(max(len(fallback)*1.3, kind * floor)); the client-sent value is advisory only. */ budget: number; /** * Developer copy. Prompt material that travels ONLY on the mint verb, * never on the read path. */ fallback: string; } /** * Art.50 disclosure for non-SDK renderers. Stripping it is a terms * violation; a resolution failure must never silence the label. */ export interface DisclosurePayload { /** Localized Art.50 disclosure label, ready to render. */ label: string; /** BCP-47 tag of the label's language. */ locale: string; /** Resolution status, e.g. attested | fail-safe. */ status: string; } /** * GET /embed/v1/fragments — cache-first microcopy for a declared context. * NEVER blocks on generation. A cold miss returns an EMPTY map with * pending:true; the client owns the fallback. */ export interface FragmentsResponse { /** * Keyed by the caller's own field names. Empty on a cold miss — never * echoes caller-supplied text. */ fragments: Record; /** Server-computed canonical hash. THE identity. Third leg of the pin key. */ contextHash: string; /** * cold = static now | warming = fill in flight | warm = generated for this * bucket. */ warmth: "cold" | "warming" | "warm"; /** True when the client should POST /mint once. */ pending?: boolean; /** W8 vocabulary, verbatim. */ degraded?: "quota" | "spend-cap" | "upstream" | "timeout"; /** * Art.50 label + locale, for non-SDK renderers. Present whenever any field * is non-static. */ disclosure?: DisclosurePayload; /** ttl, epoch, schemaHash, budget state. */ meta: unknown; } /** * POST /embed/v1/fragments/mint — the spend verb. Origin must be registered * AND verified for the paying org. Always 202; never blocks a render. */ export interface FragmentMintRequest { /** Paying organization the origin is verified for. */ organization: string; /** The declared context being minted against. */ context: DeclaredContext; /** * key, kind, budget, fallback per field. Fallback text is prompt material * and travels ONLY here. */ schema: FragmentSchemaField[]; } /** * One legal line for the viewer's market (docs/specs/market-rules.md). Added * by the server after generation; no model ever writes or rewrites it. * Render the text exactly as given. */ export interface LegalLine { /** * Stable line id. Dedupe on it: the hero and CTA islands can both carry a * CTA note. */ id: string; /** The line, plain text, verbatim. */ text: string; /** * Where the author wants it: under the whole creative, right after the * body copy, or next to the button. */ placement: "footer" | "after_body" | "cta_note"; } /** GET /embed/v1/content — the copy a client paints BEFORE opening a stream. */ export interface ContentResponse { /** Campaign served. */ campaignId: string; /** Variant served. Pin this on the subsequent stream call. */ variantId: string; /** headline / body / cta / image / experienceManifest. */ content: unknown; /** Resolved theme tokens. */ theme: ThemePayload; /** Product records for product-card components. */ products?: unknown[]; /** campaignName, goal, layout, source, duration, contentSource. */ meta: unknown; } /** * `theme-ready` — First event on a healthy stream. Sent before any copy so * the client can paint chrome in brand colors immediately. */ export interface ThemeReadyPayload { /** Token name → CSS color. */ colors: Record; /** Token name → provenance. */ sources: Record; } /** * `cta-style-ready` — Resolved CTA styling, ahead of the CTA text so the * button can be sized and colored before it has a label. */ export interface CtaStyleReadyPayload { /** * CTA style object (background, foreground, radius, weight). Shape owned * by render.ResolveCTAStyle. */ style: unknown; /** Provenance of the CTA color decision. */ ctaColorSource: string; } /** * `experience-ready` — Experience layout plus, when present, the full * experience manifest. */ export interface ExperienceReadyPayload { /** * Layout token. Selects among the 2-3 layouts a copied component * pre-declares (plan v1.1 §3.5). */ layout: string; /** Experience manifest passthrough. Shape owned by the experience package. */ experienceManifest?: unknown; } /** * `layout-ready` — Layout token alone. Redundant with * experience-ready.layout and kept because the shell listens for it; the SDK * should prefer experience-ready. */ export interface LayoutReadyPayload { /** Layout token. */ layout: string; } /** * `background-ready` — Creative background image. NOT sent when there is no * creative image — absence means keep the baked theme wash, it does not mean * clear the art layer. */ export interface BackgroundReadyPayload { /** Absolute image URL. */ bgImage: string; } /** `sequence-ready` — Multi-frame background sequence (animated creative). */ export interface SequenceReadyPayload { /** Frame image URLs in play order. */ frames: string[]; /** Index of the frame to hold as the still hero. */ heroIndex: number; /** Playback rate. */ fps: number; } /** `video-ready` — Video creative. */ export interface VideoReadyPayload { /** Absolute video URL. */ videoUrl: string; } /** * `live-ready` — Live block for the hero: the routed running channel's * cut-in (or a variant-authored block). NOT sent when no channel is running * or the block is unresolved — absence means render no player, never a * broken one. The html is the parity-locked renderLiveCard markup (Go * render.RenderLiveCard / TS lib/live-block/render-card.ts, pinned to * squid_live_markup.json); a client showing the same channelId leaves its * playing iframe alone — re-inserting an iframe reloads the player. (since * protocol 2) */ export interface LiveReadyPayload { /** Live channel id — the identity a client dedupes the card on. */ channelId: string; /** Ready-to-inject live card markup (Stream iframe player). */ html: string; } /** * `greeting-start` — Contextual kicker above the headline. Opens the field * and declares how it will arrive. */ export interface GreetingStartPayload { /** * generate → live deltas follow; release any copy hold and let them type * in. replay → the field lands as ONE block at *-done; keep holding for * the composed entrance. */ mode: "generate" | "replay"; /** * W5. Provenance of the copy about to arrive, per field. `generated` and * `cached` may carry the adaptation mark; `static` may NOT. Cached copy * WAS generated, for an earlier viewer in the same bucket — calling it * authored would be the same lie in the other direction. See decideChrome * in sdk/core/src/trust.ts, which is the one implementation of this rule. */ contentSource: "generated" | "cached" | "static"; } /** * `greeting-chunk` — Contextual kicker above the headline. Incremental * delta. */ export interface GreetingChunkPayload { /** * Delta to append. Never the full accumulated value — see splitStreamDelta * for the fat-delta split. */ text: string; } /** * `greeting-done` — Contextual kicker above the headline. Field closed; text * is final. */ export interface GreetingDonePayload { /** * The complete, final value of the field. Authoritative: a client that * missed chunks can paint this alone. */ text: string; } /** * `headline-start` — Primary headline. Opens the field and declares how it * will arrive. */ export interface HeadlineStartPayload { /** * generate → live deltas follow; release any copy hold and let them type * in. replay → the field lands as ONE block at *-done; keep holding for * the composed entrance. */ mode: "generate" | "replay"; /** * W5. Provenance of the copy about to arrive, per field. `generated` and * `cached` may carry the adaptation mark; `static` may NOT. Cached copy * WAS generated, for an earlier viewer in the same bucket — calling it * authored would be the same lie in the other direction. See decideChrome * in sdk/core/src/trust.ts, which is the one implementation of this rule. */ contentSource: "generated" | "cached" | "static"; } /** `headline-chunk` — Primary headline. Incremental delta. */ export interface HeadlineChunkPayload { /** * Delta to append. Never the full accumulated value — see splitStreamDelta * for the fat-delta split. */ text: string; } /** `headline-done` — Primary headline. Field closed; text is final. */ export interface HeadlineDonePayload { /** * The complete, final value of the field. Authoritative: a client that * missed chunks can paint this alone. */ text: string; } /** * `body-start` — Supporting body copy. Opens the field and declares how it * will arrive. */ export interface BodyStartPayload { /** * generate → live deltas follow; release any copy hold and let them type * in. replay → the field lands as ONE block at *-done; keep holding for * the composed entrance. */ mode: "generate" | "replay"; /** * W5. Provenance of the copy about to arrive, per field. `generated` and * `cached` may carry the adaptation mark; `static` may NOT. Cached copy * WAS generated, for an earlier viewer in the same bucket — calling it * authored would be the same lie in the other direction. See decideChrome * in sdk/core/src/trust.ts, which is the one implementation of this rule. */ contentSource: "generated" | "cached" | "static"; } /** `body-chunk` — Supporting body copy. Incremental delta. */ export interface BodyChunkPayload { /** * Delta to append. Never the full accumulated value — see splitStreamDelta * for the fat-delta split. */ text: string; } /** `body-done` — Supporting body copy. Field closed; text is final. */ export interface BodyDonePayload { /** * The complete, final value of the field. Authoritative: a client that * missed chunks can paint this alone. */ text: string; } /** * `cta-start` — Call-to-action label. Opens the field and declares how it * will arrive. */ export interface CtaStartPayload { /** * generate → live deltas follow; release any copy hold and let them type * in. replay → the field lands as ONE block at *-done; keep holding for * the composed entrance. */ mode: "generate" | "replay"; /** * W5. Provenance of the copy about to arrive, per field. `generated` and * `cached` may carry the adaptation mark; `static` may NOT. Cached copy * WAS generated, for an earlier viewer in the same bucket — calling it * authored would be the same lie in the other direction. See decideChrome * in sdk/core/src/trust.ts, which is the one implementation of this rule. */ contentSource: "generated" | "cached" | "static"; } /** `cta-chunk` — Call-to-action label. Incremental delta. */ export interface CtaChunkPayload { /** * Delta to append. Never the full accumulated value — see splitStreamDelta * for the fat-delta split. */ text: string; } /** `cta-done` — Call-to-action label. Field closed; text is final. */ export interface CtaDonePayload { /** * The complete, final value of the field. Authoritative: a client that * missed chunks can paint this alone. */ text: string; } /** * `legal-ready` — Legal lines for the viewer's market, sent before any copy * so they show with it and survive a failed generation. The hero island * carries every matching line; the CTA island carries only cta_note lines. * NOT sent when no line matches. When a hero stream ends without it, the * campaign has no line for this market: clear lines a previous campaign * left. (since protocol 2) */ export interface LegalReadyPayload { /** Matching lines in the author's order. */ lines: LegalLine[]; } /** * `cta-ready` — CTA text and style together, terminal for the CTA island. * Emitted after cta-done so a client that only listens for one event still * gets a complete button. */ export interface CtaReadyPayload { /** Final CTA label. */ text: string; /** * CTA destination, when the replay path knows it. The generate path * resolves the action from `done.meta.ctaAction` instead, so a client must * read both. */ action?: string; /** CTA style object. */ style: unknown; /** Provenance of the CTA color decision. */ ctaColorSource: string; } /** * `done` — Terminal success event. Exactly one per stream; a stream that * ends without it ended badly. */ export interface DonePayload { /** Attribution and provenance metadata. */ meta: DoneMeta; } /** * `error` — Terminal failure. The client keeps whatever it has already * painted — an error NEVER blanks copy the reader is mid-sentence on. */ export interface ErrorPayload { /** Human-readable reason. Not a stable machine code; do not branch on it. */ error: string; } /** * `protocol-unsupported` — W2b. The client asked for an st-protocol version * this build does not implement. Sole event on the stream; the client falls * back to its own first paint and does not retry with the same version. * (since protocol 2) */ export interface ProtocolUnsupportedPayload { /** The version the client asked for. */ requested: number; /** Versions this build implements, ascending. */ supported: number[]; } export declare const EVENT_THEME_READY = "theme-ready"; export declare const EVENT_CTA_STYLE_READY = "cta-style-ready"; export declare const EVENT_EXPERIENCE_READY = "experience-ready"; export declare const EVENT_LAYOUT_READY = "layout-ready"; export declare const EVENT_BACKGROUND_READY = "background-ready"; export declare const EVENT_SEQUENCE_READY = "sequence-ready"; export declare const EVENT_VIDEO_READY = "video-ready"; export declare const EVENT_LIVE_READY = "live-ready"; export declare const EVENT_GREETING_START = "greeting-start"; export declare const EVENT_GREETING_CHUNK = "greeting-chunk"; export declare const EVENT_GREETING_DONE = "greeting-done"; export declare const EVENT_HEADLINE_START = "headline-start"; export declare const EVENT_HEADLINE_CHUNK = "headline-chunk"; export declare const EVENT_HEADLINE_DONE = "headline-done"; export declare const EVENT_BODY_START = "body-start"; export declare const EVENT_BODY_CHUNK = "body-chunk"; export declare const EVENT_BODY_DONE = "body-done"; export declare const EVENT_CTA_START = "cta-start"; export declare const EVENT_CTA_CHUNK = "cta-chunk"; export declare const EVENT_CTA_DONE = "cta-done"; export declare const EVENT_LEGAL_READY = "legal-ready"; export declare const EVENT_CTA_READY = "cta-ready"; export declare const EVENT_DONE = "done"; export declare const EVENT_ERROR = "error"; export declare const EVENT_PROTOCOL_UNSUPPORTED = "protocol-unsupported"; /** Every event name in the contract, in declaration order. */ export declare const WIRE_EVENTS: readonly ["theme-ready", "cta-style-ready", "experience-ready", "layout-ready", "background-ready", "sequence-ready", "video-ready", "live-ready", "greeting-start", "greeting-chunk", "greeting-done", "headline-start", "headline-chunk", "headline-done", "body-start", "body-chunk", "body-done", "cta-start", "cta-chunk", "cta-done", "legal-ready", "cta-ready", "done", "error", "protocol-unsupported"]; export type WireEventName = (typeof WIRE_EVENTS)[number]; /** Minimum protocol version each event may appear on. */ export declare const EVENT_SINCE: Record; /** * Is this an event name the contract knows? An unknown event on the wire is * not an error — a newer server may emit events this client predates — but * it must be ignored, not guessed at. */ export declare function isWireEvent(name: string): name is WireEventName; /** Discriminated map from event name to its payload type. */ export interface WireEventPayloads { "theme-ready": ThemeReadyPayload; "cta-style-ready": CtaStyleReadyPayload; "experience-ready": ExperienceReadyPayload; "layout-ready": LayoutReadyPayload; "background-ready": BackgroundReadyPayload; "sequence-ready": SequenceReadyPayload; "video-ready": VideoReadyPayload; "live-ready": LiveReadyPayload; "greeting-start": GreetingStartPayload; "greeting-chunk": GreetingChunkPayload; "greeting-done": GreetingDonePayload; "headline-start": HeadlineStartPayload; "headline-chunk": HeadlineChunkPayload; "headline-done": HeadlineDonePayload; "body-start": BodyStartPayload; "body-chunk": BodyChunkPayload; "body-done": BodyDonePayload; "cta-start": CtaStartPayload; "cta-chunk": CtaChunkPayload; "cta-done": CtaDonePayload; "legal-ready": LegalReadyPayload; "cta-ready": CtaReadyPayload; "done": DonePayload; "error": ErrorPayload; "protocol-unsupported": ProtocolUnsupportedPayload; } //# sourceMappingURL=wire.d.ts.map