@rudra-js/core 0.5.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +64 -16
  2. package/dist/claim-screening.d.ts +10 -0
  3. package/dist/claim-screening.d.ts.map +1 -0
  4. package/dist/claim-screening.js +157 -0
  5. package/dist/claim-screening.js.map +1 -0
  6. package/dist/component-generator.d.ts +0 -70
  7. package/dist/component-generator.d.ts.map +1 -1
  8. package/dist/component-generator.js +27 -135
  9. package/dist/component-generator.js.map +1 -1
  10. package/dist/component-spec.d.ts +4 -159
  11. package/dist/component-spec.d.ts.map +1 -1
  12. package/dist/component-spec.js +0 -92
  13. package/dist/component-spec.js.map +1 -1
  14. package/dist/fallback-component.d.ts +0 -6
  15. package/dist/fallback-component.d.ts.map +1 -1
  16. package/dist/fallback-component.js +0 -21
  17. package/dist/fallback-component.js.map +1 -1
  18. package/dist/fit-to-shopper.d.ts +5 -1
  19. package/dist/fit-to-shopper.d.ts.map +1 -1
  20. package/dist/fit-to-shopper.js +5 -14
  21. package/dist/fit-to-shopper.js.map +1 -1
  22. package/dist/index.d.ts +1 -8
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.js +0 -7
  25. package/dist/index.js.map +1 -1
  26. package/dist/model-prompt.d.ts +1 -30
  27. package/dist/model-prompt.d.ts.map +1 -1
  28. package/dist/model-prompt.js +19 -78
  29. package/dist/model-prompt.js.map +1 -1
  30. package/dist/product-selection.d.ts +0 -29
  31. package/dist/product-selection.d.ts.map +1 -1
  32. package/dist/product-selection.js +1 -22
  33. package/dist/product-selection.js.map +1 -1
  34. package/dist/provider.d.ts +0 -55
  35. package/dist/provider.d.ts.map +1 -1
  36. package/dist/provider.js +0 -12
  37. package/dist/provider.js.map +1 -1
  38. package/dist/reconciliation.d.ts +6 -61
  39. package/dist/reconciliation.d.ts.map +1 -1
  40. package/dist/reconciliation.js +76 -466
  41. package/dist/reconciliation.js.map +1 -1
  42. package/dist/signal-digest.d.ts +1 -18
  43. package/dist/signal-digest.d.ts.map +1 -1
  44. package/dist/signal-digest.js +27 -66
  45. package/dist/signal-digest.js.map +1 -1
  46. package/dist/spec-cache.d.ts +8 -70
  47. package/dist/spec-cache.d.ts.map +1 -1
  48. package/dist/spec-cache.js +5 -68
  49. package/dist/spec-cache.js.map +1 -1
  50. package/dist/tracking-input.d.ts +0 -49
  51. package/dist/tracking-input.d.ts.map +1 -1
  52. package/dist/tracking-input.js +5 -105
  53. package/dist/tracking-input.js.map +1 -1
  54. package/package.json +7 -6
  55. package/src/claim-screening.ts +190 -0
  56. package/src/component-generator.ts +45 -240
  57. package/src/component-spec.ts +17 -118
  58. package/src/fallback-component.ts +0 -22
  59. package/src/fit-to-shopper.ts +12 -16
  60. package/src/index.ts +1 -8
  61. package/src/model-prompt.ts +25 -84
  62. package/src/product-selection.ts +6 -52
  63. package/src/provider.ts +4 -60
  64. package/src/reconciliation.ts +104 -499
  65. package/src/signal-digest.ts +34 -83
  66. package/src/spec-cache.ts +10 -97
  67. package/src/tracking-input.ts +17 -111
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
  import { SPEC_VERSION, generatedSpecSchema, } from './component-spec.js';
3
3
  import { buildFallbackSpec } from './fallback-component.js';
4
4
  import { buildPrompt } from './model-prompt.js';
5
- import { MAX_BLOCKS, bundleForShopper, placeableHeroSkus, reconcileSpec, } from './reconciliation.js';
5
+ import { bundleForShopper, capBlocks, placeableHeroSkus, reconcileSpec } from './reconciliation.js';
6
6
  import { selectProducts } from './product-selection.js';
7
7
  import { fitToShopper } from './fit-to-shopper.js';
8
8
  import { buildDigest, toCohortDigest } from './signal-digest.js';
@@ -14,20 +14,6 @@ export class TimeoutError extends Error {
14
14
  this.name = 'TimeoutError';
15
15
  }
16
16
  }
17
- /**
18
- * Races a promise against a deadline.
19
- *
20
- * The deadline is enforced here rather than trusted to the thing being waited
21
- * on. A provider that ignores its abort signal, or a store that never settles,
22
- * must still not hold a page open.
23
- *
24
- * Once the deadline has fired the caller is told so, whatever the race
25
- * actually settled with. Aborting is what makes that necessary: a provider
26
- * honouring its half of the contract rejects from inside the `abort()` below,
27
- * so its rejection reaches the race first and the deadline's own never wins.
28
- * Reporting the error that happened to arrive would blame the vendor for the
29
- * caller's deadline — and blame it most often on the best-behaved adapters.
30
- */
31
17
  async function withinBudget(label, milliseconds, start) {
32
18
  const controller = new AbortController();
33
19
  let timer;
@@ -49,14 +35,6 @@ async function withinBudget(label, milliseconds, start) {
49
35
  clearTimeout(timer);
50
36
  }
51
37
  }
52
- /**
53
- * Collapses concurrent work for the same key into one execution.
54
- *
55
- * Without this, a key that is not yet cached fans out into one model call per
56
- * concurrent request — the same answer, bought many times over. The entry is
57
- * removed as soon as it settles, so one failure does not poison the next
58
- * attempt.
59
- */
60
38
  function createSingleFlight() {
61
39
  const inFlight = new Map();
62
40
  return {
@@ -71,30 +49,13 @@ function createSingleFlight() {
71
49
  },
72
50
  };
73
51
  }
74
- /** A cache entry is no more trustworthy than model output, so it is parsed too. */
75
52
  const cachedSpecSchema = z.object({
76
53
  spec: generatedSpecSchema,
77
54
  generatedAt: z.number(),
78
55
  });
79
- /**
80
- * Fills a cohort spec with this shopper's products, keeping room for a set.
81
- *
82
- * The grid used to take the whole item budget, so a bundle block later in the
83
- * spec found nothing left and was dropped. The set is chosen first, its
84
- * products are held back from the grid, and the grid's limit drops by what the
85
- * set and the heroes have already spoken for.
86
- *
87
- * The arithmetic has to hold whatever order the model put the blocks in, so it
88
- * is written as one sum over the whole spec rather than as a running budget:
89
- * the grid gets `maxItems` minus every distinct product the set and the heroes
90
- * will place. Nothing is then dropped for want of budget, and reconciliation
91
- * reaches the same set this did — it can only ever have more placed than the
92
- * pre-choice assumed, and never one of the set's own products.
93
- */
94
- function fitCohortSpec(spec, input, digest, rank, ourReasons) {
56
+ function fitCohortSpec(spec, input, digest, rank) {
95
57
  const picks = selectProducts(input, digest, { rank });
96
- // Blocks past the cap never render, so a set is not worth reserving for one.
97
- const blocks = spec.blocks.slice(0, MAX_BLOCKS);
58
+ const blocks = capBlocks(spec.blocks);
98
59
  let hasBundleBlock = false;
99
60
  const aboveBundle = [];
100
61
  for (const block of blocks) {
@@ -105,29 +66,22 @@ function fitCohortSpec(spec, input, digest, rank, ourReasons) {
105
66
  aboveBundle.push(block);
106
67
  }
107
68
  if (!hasBundleBlock)
108
- return fitToShopper(spec, picks, digest.maxItems, ourReasons);
109
- // Only the heroes above the bundle block are placed when it is reached, so
110
- // they are all the choice may account for.
111
- const chosen = bundleForShopper(input, digest, placeableHeroSkus(aboveBundle, input, digest));
69
+ return fitToShopper(spec, picks, digest.maxItems);
70
+ const chosen = bundleForShopper(input, digest, placeableHeroSkus(aboveBundle, input));
112
71
  if (!chosen)
113
- return fitToShopper(spec, picks, digest.maxItems, ourReasons);
72
+ return fitToShopper(spec, picks, digest.maxItems);
114
73
  const spokenFor = new Set(chosen.skus);
115
- for (const sku of placeableHeroSkus(blocks, input, digest))
74
+ for (const sku of placeableHeroSkus(blocks, input))
116
75
  spokenFor.add(sku);
117
76
  const roomLeft = digest.maxItems - spokenFor.size;
118
- // A set is worth showing, but not at the cost of an empty grid.
119
77
  if (roomLeft <= 0)
120
- return fitToShopper(spec, picks, digest.maxItems, ourReasons);
78
+ return fitToShopper(spec, picks, digest.maxItems);
121
79
  const forGrid = [];
122
80
  for (const pick of picks) {
123
81
  if (!spokenFor.has(pick.product.sku))
124
82
  forGrid.push(pick);
125
83
  }
126
- return fitToShopper(spec, forGrid, roomLeft, ourReasons);
127
- }
128
- /** Attaches the provenance the server owns. The model never supplies any of it. */
129
- function withProvenance(spec, provenance) {
130
- return { ...spec, specVersion: SPEC_VERSION, ...provenance };
84
+ return fitToShopper(spec, forGrid, roomLeft);
131
85
  }
132
86
  export function createComponentGenerator(options = {}) {
133
87
  const provider = options.provider ?? null;
@@ -143,18 +97,9 @@ export function createComponentGenerator(options = {}) {
143
97
  try {
144
98
  options.onEvent(event);
145
99
  }
146
- catch {
147
- // A broken metrics hook must not take down a page.
148
- }
100
+ catch { }
149
101
  };
150
- const buildDeterministic = (input, digest, startedAt, key, degradedReason,
151
- /**
152
- * What the model call cost, when there was one. A generation that is
153
- * unusable for this shopper was still asked for and still billed, so
154
- * omitting it here would hide the calls that produce nothing — exactly the
155
- * ones worth knowing about.
156
- */
157
- modelCall = {
102
+ const buildDeterministic = (input, digest, startedAt, key, degradedReason, modelCall = {
158
103
  calledModel: false,
159
104
  }) => {
160
105
  const finishedAt = Date.now();
@@ -165,7 +110,9 @@ export function createComponentGenerator(options = {}) {
165
110
  ...modelCall,
166
111
  degradedReason,
167
112
  });
168
- return withProvenance(buildFallbackSpec(input, digest, { rank }), {
113
+ return {
114
+ ...buildFallbackSpec(input, digest, { rank }),
115
+ specVersion: SPEC_VERSION,
169
116
  slot: digest.slot,
170
117
  source: 'fallback',
171
118
  generatedAt: finishedAt,
@@ -173,17 +120,8 @@ export function createComponentGenerator(options = {}) {
173
120
  provider: null,
174
121
  model: null,
175
122
  degradedReason,
176
- });
123
+ };
177
124
  };
178
- /**
179
- * Reads the cache, treating anything unexpected as a miss.
180
- *
181
- * The value is re-validated because a store is a port a host implements, and
182
- * what comes back is no more trustworthy than what a model returns — a shared
183
- * store outlives a deploy, so it can hold entries written by an older shape of
184
- * the spec. Generating again is always safe; handing an unvalidated object to
185
- * reconciliation is not.
186
- */
187
125
  const readCache = async (key) => {
188
126
  try {
189
127
  const stored = await withinBudget('cache read', cacheTimeoutMs, () => cache.get(key));
@@ -191,42 +129,17 @@ export function createComponentGenerator(options = {}) {
191
129
  return parsed.success ? { outcome: 'hit', entry: parsed.data } : { outcome: 'miss' };
192
130
  }
193
131
  catch (error) {
194
- // A store that is down or slow degrades to generating, not to an error
195
- // page. Nothing here is worth failing a render over.
196
132
  return { outcome: error instanceof TimeoutError ? 'timeout' : 'error' };
197
133
  }
198
134
  };
199
- /**
200
- * Writes to the cache without the render waiting for it.
201
- *
202
- * The spec is already in hand; nothing downstream needs the write to finish.
203
- * Awaiting it put a second unbounded call to a host-implemented store on the
204
- * render path, which is the failure this module exists to prevent arriving
205
- * through the other door. The `Promise.resolve` wrapper is what catches a
206
- * store that throws synchronously rather than rejecting.
207
- */
208
135
  const storeInBackground = (key, cached) => {
209
136
  void Promise.resolve()
210
137
  .then(() => cache.set(key, cached))
211
- .catch(() => {
212
- // A store that cannot be written is not a reason to fail a render.
213
- });
138
+ .catch(() => { });
214
139
  };
215
- /**
216
- * Asks the model.
217
- *
218
- * Deliberately does not decide whether the answer is usable. That depends on
219
- * the asking shopper's live facts — stock, dislikes, what is in their basket
220
- * — and none of those are in the cache key, so a verdict reached here would
221
- * be handed to every request that joined this one. A null `spec` in the
222
- * result means the answer did not satisfy the schema, which is a fault of the
223
- * adapter rather than a judgement about any shopper — and is still a call
224
- * that happened, so its usage comes back with it.
225
- */
226
140
  const askModel = async (active, input, promptDigest) => {
227
141
  const { system, user } = buildPrompt(input, promptDigest);
228
142
  const result = await withinBudget('generation', modelTimeoutMs, (signal) => active.generate({ system, user, schema: generatedSpecSchema, signal }));
229
- // Providers return parsed objects, but the shape is still model output.
230
143
  const parsed = generatedSpecSchema.safeParse(result.spec);
231
144
  return {
232
145
  spec: parsed.success ? parsed.data : null,
@@ -241,33 +154,26 @@ export function createComponentGenerator(options = {}) {
241
154
  },
242
155
  async generate(draft) {
243
156
  const startedAt = Date.now();
244
- // Deliberately unguarded: an invalid payload is a caller bug, not a
245
- // degraded render.
246
157
  const input = parseTrackingInput(draft);
247
158
  const digest = buildDigest(input);
248
159
  if (!provider) {
249
160
  return buildDeterministic(input, digest, startedAt, null, 'no-provider');
250
161
  }
251
- const providerId = `${provider.name}:${provider.model}`;
162
+ const identity = { name: provider.name, model: provider.model };
163
+ const candidateSkus = input.candidates.map((product) => product.sku);
252
164
  const key = generation === 'cohort'
253
- ? cohortCacheKey(digest, input.candidates.map((product) => product.sku), providerId)
254
- : specCacheKey(digest, input.candidates.map((product) => product.sku), providerId);
165
+ ? cohortCacheKey(digest, candidateSkus, identity)
166
+ : specCacheKey(digest, candidateSkus, identity);
255
167
  const read = await readCache(key);
256
168
  const cached = read.entry;
257
169
  let calledModel = false;
258
170
  let answer;
259
- // When the model produced this, not when it was served. A cached
260
- // component is not newly generated, and pretending otherwise makes any
261
- // measure of how stale a page is showing read as zero.
262
171
  let generatedAt;
263
172
  if (cached) {
264
173
  answer = { spec: cached.spec };
265
174
  generatedAt = cached.generatedAt;
266
175
  }
267
176
  else {
268
- // Asked before joining, because by the time the shared promise settles
269
- // the entry is gone and there is no way to tell a leader from a
270
- // follower — and they must not both be counted as a model call.
271
177
  calledModel = !singleFlight.isRunning(key);
272
178
  let call;
273
179
  try {
@@ -275,9 +181,6 @@ export function createComponentGenerator(options = {}) {
275
181
  }
276
182
  catch (error) {
277
183
  const reason = error instanceof TimeoutError ? 'timeout' : 'provider-error';
278
- // The request went out. Leaving `calledModel` to default here reported
279
- // every failed call as no call at all, so the calls that cost money
280
- // and produced nothing were the only ones missing from the count.
281
184
  return buildDeterministic(input, digest, startedAt, key, reason, {
282
185
  calledModel,
283
186
  cache: read.outcome,
@@ -293,25 +196,12 @@ export function createComponentGenerator(options = {}) {
293
196
  }
294
197
  answer = { spec: call.spec, ...(call.usage ? { usage: call.usage } : {}) };
295
198
  generatedAt = Date.now();
296
- // Stored unreconciled on purpose, and stored even when it is unusable
297
- // for this shopper. Reconciliation narrows a spec to one shopper's live
298
- // facts, and those move independently of the key — a product can sell
299
- // out and come back without the candidate list changing. Keeping what
300
- // the model said means the restock is picked up from cache rather than
301
- // paid for again.
302
199
  if (calledModel)
303
200
  storeInBackground(key, { spec: answer.spec, generatedAt });
304
201
  }
305
- // One place where anything is served, whichever side of the cache it came
306
- // from, and always against the facts of the shopper asking now.
307
- // A cohort spec names products chosen for whoever asked first, and every
308
- // reason under one of them is written here rather than by the model. Only
309
- // the cohort path does that, so in per-shopper mode this stays empty and
310
- // every reason is screened.
311
- const ourReasons = new Map();
312
- const served = generation === 'cohort'
313
- ? fitCohortSpec(answer.spec, input, digest, rank, ourReasons)
314
- : answer.spec;
202
+ const { spec: served, ourReasons } = generation === 'cohort'
203
+ ? fitCohortSpec(answer.spec, input, digest, rank)
204
+ : { spec: answer.spec, ourReasons: new Map() };
315
205
  const reconciled = reconcileSpec(served, input, digest, ourReasons);
316
206
  if (!reconciled.isUsable) {
317
207
  return buildDeterministic(input, digest, startedAt, key, 'unusable-on-serve', {
@@ -332,14 +222,16 @@ export function createComponentGenerator(options = {}) {
332
222
  violations: reconciled.violations,
333
223
  ...(answer.usage ? { usage: answer.usage } : {}),
334
224
  });
335
- return withProvenance(reconciled.spec, {
225
+ return {
226
+ ...reconciled.spec,
227
+ specVersion: SPEC_VERSION,
336
228
  slot: digest.slot,
337
229
  source,
338
230
  generatedAt,
339
231
  latencyMs: finishedAt - startedAt,
340
232
  provider: provider.name,
341
233
  model: provider.model,
342
- });
234
+ };
343
235
  },
344
236
  };
345
237
  }
@@ -1 +1 @@
1
- {"version":3,"file":"component-generator.js","sourceRoot":"","sources":["../src/component-generator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,YAAY,EACZ,mBAAmB,GAMpB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,aAAa,GACd,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,cAAc,EAAoC,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,cAAc,EAAqB,MAAM,oBAAoB,CAAC;AACpF,OAAO,EACL,qBAAqB,EACrB,cAAc,EACd,YAAY,GAGb,MAAM,iBAAiB,CAAC;AACzB,O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BACL,GAAG,UAAU,CAAC,IAAI;gBAClB,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM;gBACN,WAAW;gBACX,SAAS,EAAE,UAAU,GAAG,SAAS;gBACjC,QAAQ,EAAE,QAAQ,CAAC,IAAI;gBACvB,KAAK,EAAE,QAAQ,CAAC,KAAK;aACtB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,72 +1,8 @@
1
1
  import { z } from 'zod';
2
- /**
3
- * The component specification — the only thing a language model is ever allowed
4
- * to return.
5
- *
6
- * The model chooses layout, ordering, emphasis and copy. Which products to show
7
- * and why is its call only in per-shopper mode, apart from the product a hero
8
- * names. It never returns markup, code, URLs, prices, product titles, or
9
- * images. Every field is an enum, a bounded number, a SKU reference resolved
10
- * against the candidate set, or free text that is clamped and escaped before it
11
- * renders. That is what makes generated output safe to put in a server-rendered
12
- * response.
13
- *
14
- * Two constraints shape this file, and both are easy to undo by accident:
15
- *
16
- * 1. It doubles as a provider structured-output schema, so it avoids
17
- * recursion, string length bounds, and numeric ranges. Providers reject
18
- * schemas that use them in strict mode. Bounds are enforced afterwards, in
19
- * reconciliation, where a violation can be repaired rather than fatal.
20
- * 2. Optionality is `.nullable()` rather than `.optional()`, because strict
21
- * structured outputs require every declared property to be present. "No
22
- * badge" has to be expressible as `null`, not as a missing key.
23
- *
24
- * A test asserts both by converting this schema to JSON Schema, so neither is
25
- * left to a comment nobody reads.
26
- *
27
- * Note the asymmetry with `tracking-input`, which rejects unknown fields: these
28
- * schemas strip them. The inputs differ in kind. An unrecognised key in a host
29
- * payload is a typo, and silently dropping it costs the shopper their history,
30
- * so it must be loud. An unrecognised key from a model is drift, and discarding
31
- * it is exactly right — rejecting the whole spec over one stray key would cost
32
- * the shopper the component. Either way the renderer only ever sees the fields
33
- * declared here, which is the property that matters.
34
- */
35
- /** Overall voice of the component. */
36
2
  export declare const TONES: readonly ['neutral', 'enthusiastic', 'urgent', 'editorial'];
37
- /** What a banner is claiming. */
38
3
  export declare const BANNER_TONES: readonly ['info', 'promo', 'urgency', 'restock'];
39
- /** How prominently a single product is placed. */
40
4
  export declare const EMPHASIS: readonly ['normal', 'featured'];
41
- /**
42
- * Why a product was chosen — the recommendation strategy behind the pick.
43
- *
44
- * This is a closed set rather than free text because every value here is a
45
- * factual claim about the shopper, and a claim the server can check. "Because
46
- * you viewed this" written as prose is unverifiable: nothing downstream can
47
- * tell whether the shopper viewed anything. Declared as `most_viewed`,
48
- * reconciliation can look it up in the digest and drop the claim if it is
49
- * false.
50
- *
51
- * Every value is deliberately checkable against data already in hand — the
52
- * signal digest or the host's own catalog. A basis that needs data the
53
- * framework never receives (`new_arrival`, `back_in_stock`, `trending_today`)
54
- * is not in this list, because it could only ever be taken on trust.
55
- */
56
- export declare const RECOMMENDATION_BASES: readonly [
57
- /** Same category as the product being viewed. */
58
- 'similar_to_current',
59
- /** The shopper has viewed this product. */
60
- 'most_viewed',
61
- /** Goes with something already in the cart. */
62
- 'complements_cart',
63
- /** Goes with something the shopper has bought. */
64
- 'complements_purchase',
65
- /** In a category the shopper's signals favour. */
66
- 'liked_category',
67
- /** No claim about this shopper at all — the safe default. */
68
- 'popular'];
69
- /** A reference to one product from the candidate set, and why it was chosen. */
5
+ export declare const RECOMMENDATION_BASES: readonly ['similar_to_current', 'most_viewed', 'complements_cart', 'complements_purchase', 'liked_category', 'popular'];
70
6
  export declare const productReferenceSchema: z.ZodObject<{
71
7
  sku: z.ZodString;
72
8
  basis: z.ZodEnum<{
@@ -86,7 +22,6 @@ export declare const productReferenceSchema: z.ZodObject<{
86
22
  }, z.core.$strip>;
87
23
  export type ProductReference = z.infer<typeof productReferenceSchema>;
88
24
  export type RecommendationBasis = (typeof RECOMMENDATION_BASES)[number];
89
- /** One large featured statement, optionally anchored to a single product. */
90
25
  declare const heroBlockSchema: z.ZodObject<{
91
26
  kind: z.ZodLiteral<"hero">;
92
27
  headline: z.ZodString;
@@ -94,7 +29,6 @@ declare const heroBlockSchema: z.ZodObject<{
94
29
  sku: z.ZodNullable<z.ZodString>;
95
30
  ctaLabel: z.ZodNullable<z.ZodString>;
96
31
  }, z.core.$strip>;
97
- /** The general-purpose choice when several products are comparably relevant. */
98
32
  declare const gridBlockSchema: z.ZodObject<{
99
33
  kind: z.ZodLiteral<"grid">;
100
34
  title: z.ZodNullable<z.ZodString>;
@@ -117,7 +51,6 @@ declare const gridBlockSchema: z.ZodObject<{
117
51
  }>;
118
52
  }, z.core.$strip>>;
119
53
  }, z.core.$strip>;
120
- /** A horizontally scanned row, for when order implies a ranking. */
121
54
  declare const carouselBlockSchema: z.ZodObject<{
122
55
  kind: z.ZodLiteral<"carousel">;
123
56
  title: z.ZodNullable<z.ZodString>;
@@ -139,7 +72,6 @@ declare const carouselBlockSchema: z.ZodObject<{
139
72
  }>;
140
73
  }, z.core.$strip>>;
141
74
  }, z.core.$strip>;
142
- /** A single line of merchandising copy. */
143
75
  declare const bannerBlockSchema: z.ZodObject<{
144
76
  kind: z.ZodLiteral<"banner">;
145
77
  tone: z.ZodEnum<{
@@ -151,13 +83,11 @@ declare const bannerBlockSchema: z.ZodObject<{
151
83
  text: z.ZodString;
152
84
  ctaLabel: z.ZodNullable<z.ZodString>;
153
85
  }, z.core.$strip>;
154
- /** Short editorial prose, for explaining the theme of a selection. */
155
86
  declare const copyBlockSchema: z.ZodObject<{
156
87
  kind: z.ZodLiteral<"copy">;
157
88
  title: z.ZodNullable<z.ZodString>;
158
89
  body: z.ZodString;
159
90
  }, z.core.$strip>;
160
- /** A set the shop sells together. The shop picks which one; this only asks for it. */
161
91
  declare const bundleBlockSchema: z.ZodObject<{
162
92
  kind: z.ZodLiteral<"bundle">;
163
93
  title: z.ZodNullable<z.ZodString>;
@@ -165,7 +95,6 @@ declare const bundleBlockSchema: z.ZodObject<{
165
95
  ctaLabel: z.ZodNullable<z.ZodString>;
166
96
  bundleId: z.ZodNullable<z.ZodString>;
167
97
  }, z.core.$strip>;
168
- /** Blocks do not nest. The vocabulary is closed on purpose. */
169
98
  export declare const blockSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
170
99
  kind: z.ZodLiteral<"hero">;
171
100
  headline: z.ZodString;
@@ -242,11 +171,6 @@ export type CarouselBlock = z.infer<typeof carouselBlockSchema>;
242
171
  export type BannerBlock = z.infer<typeof bannerBlockSchema>;
243
172
  export type CopyBlock = z.infer<typeof copyBlockSchema>;
244
173
  export type BundleBlock = z.infer<typeof bundleBlockSchema>;
245
- /**
246
- * Exactly what the model must return. Provenance — version, slot, latency, which
247
- * provider answered — is added by the server afterwards, and is deliberately not
248
- * part of the model's burden.
249
- */
250
174
  export declare const generatedSpecSchema: z.ZodObject<{
251
175
  tone: z.ZodEnum<{
252
176
  editorial: "editorial";
@@ -327,100 +251,21 @@ export declare const generatedSpecSchema: z.ZodObject<{
327
251
  rationale: z.ZodString;
328
252
  }, z.core.$strip>;
329
253
  export type GeneratedSpec = z.infer<typeof generatedSpecSchema>;
330
- /** How a spec came to exist. Surfaced for benchmarking and observability. */
254
+ export type GeneratedSpecResult = z.ZodSafeParseResult<GeneratedSpec>;
331
255
  export type SpecSource = 'llm' | 'cache' | 'fallback';
332
- /**
333
- * Why a component is not what the model would have produced.
334
- *
335
- * A closed set, like `SpecSource`: it is rendered into pages as
336
- * `data-rudra-degraded` and counted in dashboards, so a host needs to know what
337
- * it can receive without reading the generator.
338
- */
339
- export type DegradedReason =
340
- /** No provider was configured, so nothing was ever asked. */
341
- 'no-provider'
342
- /** The provider errored, or threw before it reached the vendor. */
343
- | 'provider-error'
344
- /** The deadline fired before an answer arrived. */
345
- | 'timeout'
346
- /** An answer came back that did not satisfy the schema. */
347
- | 'invalid-generation'
348
- /** A usable answer reconciled down to nothing for this shopper. */
349
- | 'unusable-on-serve'
350
- /** The caller asked for the deterministic component on purpose. */
351
- | 'requested';
256
+ export type DegradedReason = 'no-provider' | 'provider-error' | 'timeout' | 'invalid-generation' | 'unusable-on-serve' | 'requested';
352
257
  export declare const SPEC_VERSION: '1';
353
- /** A generated spec plus the provenance the server owns. This is what renders. */
354
258
  export interface ComponentSpec extends GeneratedSpec {
355
259
  specVersion: typeof SPEC_VERSION;
356
260
  slot: string;
357
261
  source: SpecSource;
358
- /** Epoch milliseconds at which the underlying generation completed. */
359
262
  generatedAt: number;
360
- /** Wall-clock milliseconds spent producing it, including any cache lookup. */
361
263
  latencyMs: number;
362
- /** Provider name, or null when no model was involved. */
363
264
  provider: string | null;
364
- /** Model identifier, or null when no model was involved. */
365
265
  model: string | null;
366
- /**
367
- * Why the deterministic component is showing instead of a generated one.
368
- * Present on every fallback, including the ones where no model was involved
369
- * at all — no provider configured, or the caller asked for it directly.
370
- */
371
266
  degradedReason?: DegradedReason;
372
267
  }
373
- /** Throws a `ZodError` if the value is not a well-formed generated spec. */
374
268
  export declare function parseGeneratedSpec(value: unknown): GeneratedSpec;
375
- /** Non-throwing variant, for validating untrusted model output. */
376
- export declare function safeParseGeneratedSpec(value: unknown): z.ZodSafeParseResult<{
377
- tone: "editorial" | "enthusiastic" | "neutral" | "urgent";
378
- headline: string;
379
- subheadline: string | null;
380
- blocks: ({
381
- kind: "hero";
382
- headline: string;
383
- body: string | null;
384
- sku: string | null;
385
- ctaLabel: string | null;
386
- } | {
387
- kind: "grid";
388
- title: string | null;
389
- columns: 2 | 3 | 4;
390
- items: {
391
- sku: string;
392
- basis: "complements_cart" | "complements_purchase" | "liked_category" | "most_viewed" | "popular" | "similar_to_current";
393
- reason: string | null;
394
- badge: string | null;
395
- emphasis: "featured" | "normal";
396
- }[];
397
- } | {
398
- kind: "carousel";
399
- title: string | null;
400
- items: {
401
- sku: string;
402
- basis: "complements_cart" | "complements_purchase" | "liked_category" | "most_viewed" | "popular" | "similar_to_current";
403
- reason: string | null;
404
- badge: string | null;
405
- emphasis: "featured" | "normal";
406
- }[];
407
- } | {
408
- kind: "banner";
409
- tone: "info" | "promo" | "restock" | "urgency";
410
- text: string;
411
- ctaLabel: string | null;
412
- } | {
413
- kind: "copy";
414
- title: string | null;
415
- body: string;
416
- } | {
417
- kind: "bundle";
418
- title: string | null;
419
- body: string | null;
420
- ctaLabel: string | null;
421
- bundleId: string | null;
422
- })[];
423
- rationale: string;
424
- }>;
269
+ export declare function safeParseGeneratedSpec(value: unknown): GeneratedSpecResult;
425
270
  export {};
426
271
  //# sourceMappingURL=component-spec.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-spec.d.ts","sourceRoot":"","sources":["../src/component-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,sCAAsC;AACtC,eAAO,MAAM,KAAK,YAAI,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAEjF,iCAAiC;AACjC,eAAO,MAAM,YAAY,YAAI,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAE7E,kDAAkD;AAClD,eAAO,MAAM,QAAQ,YAAI,QAAQ,EAAE,UAAU,CAAU,CAAC;AAExD;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,oBAAoB;AAC/B,iDAAiD;AACjD,oBAAoB;AACpB,2CAA2C;AAC3C,aAAa;AACb,+CAA+C;AAC/C,kBAAkB;AAClB,kDAAkD;AAClD,sBAAsB;AACtB,kDAAkD;AAClD,gBAAgB;AAChB,6DAA6D;AAC7D,SAAS,CACD,CAAC;AAEX,gFAAgF;AAChF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;iBAqBjC,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACtE,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,6EAA6E;AAC7E,QAAA,MAAM,eAAe;;;;;;iBAMnB,CAAC;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