@rudra-js/core 0.4.0 → 0.6.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.
- package/README.md +139 -15
- package/dist/claim-screening.d.ts +33 -0
- package/dist/claim-screening.d.ts.map +1 -0
- package/dist/claim-screening.js +226 -0
- package/dist/claim-screening.js.map +1 -0
- package/dist/component-generator.d.ts.map +1 -1
- package/dist/component-generator.js +33 -98
- package/dist/component-generator.js.map +1 -1
- package/dist/component-spec.d.ts +2 -49
- package/dist/component-spec.d.ts.map +1 -1
- package/dist/component-spec.js +3 -17
- package/dist/component-spec.js.map +1 -1
- package/dist/fallback-component.d.ts +3 -0
- package/dist/fallback-component.d.ts.map +1 -1
- package/dist/fallback-component.js +3 -13
- package/dist/fallback-component.js.map +1 -1
- package/dist/fit-to-shopper.d.ts +5 -1
- package/dist/fit-to-shopper.d.ts.map +1 -1
- package/dist/fit-to-shopper.js +6 -4
- package/dist/fit-to-shopper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/model-prompt.d.ts +13 -1
- package/dist/model-prompt.d.ts.map +1 -1
- package/dist/model-prompt.js +53 -21
- package/dist/model-prompt.js.map +1 -1
- package/dist/product-selection.d.ts +1 -9
- package/dist/product-selection.d.ts.map +1 -1
- package/dist/product-selection.js +1 -4
- package/dist/product-selection.js.map +1 -1
- package/dist/provider.d.ts +1 -8
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js +1 -8
- package/dist/provider.js.map +1 -1
- package/dist/reconciliation.d.ts +15 -12
- package/dist/reconciliation.d.ts.map +1 -1
- package/dist/reconciliation.js +150 -340
- package/dist/reconciliation.js.map +1 -1
- package/dist/signal-digest.d.ts +10 -0
- package/dist/signal-digest.d.ts.map +1 -1
- package/dist/signal-digest.js +38 -28
- package/dist/signal-digest.js.map +1 -1
- package/dist/spec-cache.d.ts +14 -2
- package/dist/spec-cache.d.ts.map +1 -1
- package/dist/spec-cache.js +14 -24
- package/dist/spec-cache.js.map +1 -1
- package/dist/tracking-input.d.ts.map +1 -1
- package/dist/tracking-input.js +15 -13
- package/dist/tracking-input.js.map +1 -1
- package/package.json +4 -2
- package/src/claim-screening.ts +242 -0
- package/src/component-generator.ts +38 -123
- package/src/component-spec.ts +5 -18
- package/src/fallback-component.ts +3 -14
- package/src/fit-to-shopper.ts +11 -4
- package/src/index.ts +1 -0
- package/src/model-prompt.ts +58 -23
- package/src/product-selection.ts +2 -13
- package/src/provider.ts +1 -8
- package/src/reconciliation.ts +178 -359
- package/src/signal-digest.ts +41 -31
- package/src/spec-cache.ts +27 -24
- package/src/tracking-input.ts +16 -13
|
@@ -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 {
|
|
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';
|
|
@@ -15,18 +15,10 @@ export class TimeoutError extends Error {
|
|
|
15
15
|
}
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
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.
|
|
18
|
+
* Once the deadline has fired the caller is told so, whatever the race actually
|
|
19
|
+
* settled with: a provider honouring its half of the contract rejects from
|
|
20
|
+
* inside the `abort()` below, so its rejection reaches the race first and the
|
|
21
|
+
* deadline's own never wins.
|
|
30
22
|
*/
|
|
31
23
|
async function withinBudget(label, milliseconds, start) {
|
|
32
24
|
const controller = new AbortController();
|
|
@@ -49,14 +41,6 @@ async function withinBudget(label, milliseconds, start) {
|
|
|
49
41
|
clearTimeout(timer);
|
|
50
42
|
}
|
|
51
43
|
}
|
|
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
44
|
function createSingleFlight() {
|
|
61
45
|
const inFlight = new Map();
|
|
62
46
|
return {
|
|
@@ -77,24 +61,16 @@ const cachedSpecSchema = z.object({
|
|
|
77
61
|
generatedAt: z.number(),
|
|
78
62
|
});
|
|
79
63
|
/**
|
|
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
64
|
* The arithmetic has to hold whatever order the model put the blocks in, so it
|
|
88
65
|
* is written as one sum over the whole spec rather than as a running budget:
|
|
89
66
|
* the grid gets `maxItems` minus every distinct product the set and the heroes
|
|
90
|
-
* will place.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
67
|
+
* will place. Reconciliation then reaches the same set this did — it can only
|
|
68
|
+
* ever have more placed than the pre-choice assumed, and never one of the set's
|
|
69
|
+
* own products.
|
|
93
70
|
*/
|
|
94
|
-
function fitCohortSpec(spec, input, digest, rank
|
|
71
|
+
function fitCohortSpec(spec, input, digest, rank) {
|
|
95
72
|
const picks = selectProducts(input, digest, { rank });
|
|
96
|
-
|
|
97
|
-
const blocks = spec.blocks.slice(0, MAX_BLOCKS);
|
|
73
|
+
const blocks = capBlocks(spec.blocks);
|
|
98
74
|
let hasBundleBlock = false;
|
|
99
75
|
const aboveBundle = [];
|
|
100
76
|
for (const block of blocks) {
|
|
@@ -105,27 +81,26 @@ function fitCohortSpec(spec, input, digest, rank, hostReasonSkus) {
|
|
|
105
81
|
aboveBundle.push(block);
|
|
106
82
|
}
|
|
107
83
|
if (!hasBundleBlock)
|
|
108
|
-
return fitToShopper(spec, picks, digest.maxItems
|
|
84
|
+
return fitToShopper(spec, picks, digest.maxItems);
|
|
109
85
|
// Only the heroes above the bundle block are placed when it is reached, so
|
|
110
86
|
// they are all the choice may account for.
|
|
111
|
-
const chosen = bundleForShopper(input, digest, placeableHeroSkus(aboveBundle, input
|
|
87
|
+
const chosen = bundleForShopper(input, digest, placeableHeroSkus(aboveBundle, input));
|
|
112
88
|
if (!chosen)
|
|
113
|
-
return fitToShopper(spec, picks, digest.maxItems
|
|
89
|
+
return fitToShopper(spec, picks, digest.maxItems);
|
|
114
90
|
const spokenFor = new Set(chosen.skus);
|
|
115
|
-
for (const sku of placeableHeroSkus(blocks, input
|
|
91
|
+
for (const sku of placeableHeroSkus(blocks, input))
|
|
116
92
|
spokenFor.add(sku);
|
|
117
93
|
const roomLeft = digest.maxItems - spokenFor.size;
|
|
118
94
|
// A set is worth showing, but not at the cost of an empty grid.
|
|
119
95
|
if (roomLeft <= 0)
|
|
120
|
-
return fitToShopper(spec, picks, digest.maxItems
|
|
96
|
+
return fitToShopper(spec, picks, digest.maxItems);
|
|
121
97
|
const forGrid = [];
|
|
122
98
|
for (const pick of picks) {
|
|
123
99
|
if (!spokenFor.has(pick.product.sku))
|
|
124
100
|
forGrid.push(pick);
|
|
125
101
|
}
|
|
126
|
-
return fitToShopper(spec, forGrid, roomLeft
|
|
102
|
+
return fitToShopper(spec, forGrid, roomLeft);
|
|
127
103
|
}
|
|
128
|
-
/** Attaches the provenance the server owns. The model never supplies any of it. */
|
|
129
104
|
function withProvenance(spec, provenance) {
|
|
130
105
|
return { ...spec, specVersion: SPEC_VERSION, ...provenance };
|
|
131
106
|
}
|
|
@@ -147,14 +122,7 @@ export function createComponentGenerator(options = {}) {
|
|
|
147
122
|
// A broken metrics hook must not take down a page.
|
|
148
123
|
}
|
|
149
124
|
};
|
|
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 = {
|
|
125
|
+
const buildDeterministic = (input, digest, startedAt, key, degradedReason, modelCall = {
|
|
158
126
|
calledModel: false,
|
|
159
127
|
}) => {
|
|
160
128
|
const finishedAt = Date.now();
|
|
@@ -175,15 +143,6 @@ export function createComponentGenerator(options = {}) {
|
|
|
175
143
|
degradedReason,
|
|
176
144
|
});
|
|
177
145
|
};
|
|
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
146
|
const readCache = async (key) => {
|
|
188
147
|
try {
|
|
189
148
|
const stored = await withinBudget('cache read', cacheTimeoutMs, () => cache.get(key));
|
|
@@ -191,20 +150,11 @@ export function createComponentGenerator(options = {}) {
|
|
|
191
150
|
return parsed.success ? { outcome: 'hit', entry: parsed.data } : { outcome: 'miss' };
|
|
192
151
|
}
|
|
193
152
|
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.
|
|
153
|
+
// A store that is down or slow degrades to generating, not to an error page.
|
|
196
154
|
return { outcome: error instanceof TimeoutError ? 'timeout' : 'error' };
|
|
197
155
|
}
|
|
198
156
|
};
|
|
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
|
-
*/
|
|
157
|
+
/** The `Promise.resolve` wrapper catches a store that throws synchronously rather than rejecting. */
|
|
208
158
|
const storeInBackground = (key, cached) => {
|
|
209
159
|
void Promise.resolve()
|
|
210
160
|
.then(() => cache.set(key, cached))
|
|
@@ -213,15 +163,10 @@ export function createComponentGenerator(options = {}) {
|
|
|
213
163
|
});
|
|
214
164
|
};
|
|
215
165
|
/**
|
|
216
|
-
* Asks the model.
|
|
217
|
-
*
|
|
218
166
|
* Deliberately does not decide whether the answer is usable. That depends on
|
|
219
167
|
* the asking shopper's live facts — stock, dislikes, what is in their basket
|
|
220
168
|
* — 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.
|
|
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.
|
|
169
|
+
* be handed to every request that joined this one.
|
|
225
170
|
*/
|
|
226
171
|
const askModel = async (active, input, promptDigest) => {
|
|
227
172
|
const { system, user } = buildPrompt(input, promptDigest);
|
|
@@ -248,17 +193,16 @@ export function createComponentGenerator(options = {}) {
|
|
|
248
193
|
if (!provider) {
|
|
249
194
|
return buildDeterministic(input, digest, startedAt, null, 'no-provider');
|
|
250
195
|
}
|
|
251
|
-
const
|
|
196
|
+
const identity = { name: provider.name, model: provider.model };
|
|
197
|
+
const candidateSkus = input.candidates.map((product) => product.sku);
|
|
252
198
|
const key = generation === 'cohort'
|
|
253
|
-
? cohortCacheKey(digest,
|
|
254
|
-
: specCacheKey(digest,
|
|
199
|
+
? cohortCacheKey(digest, candidateSkus, identity)
|
|
200
|
+
: specCacheKey(digest, candidateSkus, identity);
|
|
255
201
|
const read = await readCache(key);
|
|
256
202
|
const cached = read.entry;
|
|
257
203
|
let calledModel = false;
|
|
258
204
|
let answer;
|
|
259
|
-
// When the model produced this, not when it was served.
|
|
260
|
-
// component is not newly generated, and pretending otherwise makes any
|
|
261
|
-
// measure of how stale a page is showing read as zero.
|
|
205
|
+
// When the model produced this, not when it was served.
|
|
262
206
|
let generatedAt;
|
|
263
207
|
if (cached) {
|
|
264
208
|
answer = { spec: cached.spec };
|
|
@@ -266,8 +210,7 @@ export function createComponentGenerator(options = {}) {
|
|
|
266
210
|
}
|
|
267
211
|
else {
|
|
268
212
|
// 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.
|
|
213
|
+
// the entry is gone and there is no way to tell a leader from a follower.
|
|
271
214
|
calledModel = !singleFlight.isRunning(key);
|
|
272
215
|
let call;
|
|
273
216
|
try {
|
|
@@ -275,9 +218,6 @@ export function createComponentGenerator(options = {}) {
|
|
|
275
218
|
}
|
|
276
219
|
catch (error) {
|
|
277
220
|
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
221
|
return buildDeterministic(input, digest, startedAt, key, reason, {
|
|
282
222
|
calledModel,
|
|
283
223
|
cache: read.outcome,
|
|
@@ -296,22 +236,17 @@ export function createComponentGenerator(options = {}) {
|
|
|
296
236
|
// Stored unreconciled on purpose, and stored even when it is unusable
|
|
297
237
|
// for this shopper. Reconciliation narrows a spec to one shopper's live
|
|
298
238
|
// facts, and those move independently of the key — a product can sell
|
|
299
|
-
// out and come back without the candidate list changing.
|
|
300
|
-
// the model said means the restock is picked up from cache rather than
|
|
301
|
-
// paid for again.
|
|
239
|
+
// out and come back without the candidate list changing.
|
|
302
240
|
if (calledModel)
|
|
303
241
|
storeInBackground(key, { spec: answer.spec, generatedAt });
|
|
304
242
|
}
|
|
305
|
-
//
|
|
306
|
-
//
|
|
307
|
-
// A cohort spec names products chosen for whoever asked first.
|
|
308
|
-
// Only the cohort path writes a host reason into a spec, so in
|
|
243
|
+
// A cohort spec names products chosen for whoever asked first, and every
|
|
244
|
+
// reason under one of them is written here rather than by the model. In
|
|
309
245
|
// per-shopper mode this stays empty and every reason is screened.
|
|
310
|
-
const
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
const reconciled = reconcileSpec(served, input, digest, hostReasonSkus);
|
|
246
|
+
const { spec: served, ourReasons } = generation === 'cohort'
|
|
247
|
+
? fitCohortSpec(answer.spec, input, digest, rank)
|
|
248
|
+
: { spec: answer.spec, ourReasons: new Map() };
|
|
249
|
+
const reconciled = reconcileSpec(served, input, digest, ourReasons);
|
|
315
250
|
if (!reconciled.isUsable) {
|
|
316
251
|
return buildDeterministic(input, digest, startedAt, key, 'unusable-on-serve', {
|
|
317
252
|
calledModel,
|
|
@@ -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,iBA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z.ZodObject<{
|
|
|
327
327
|
rationale: z.ZodString;
|
|
328
328
|
}, z.core.$strip>;
|
|
329
329
|
export type GeneratedSpec = z.infer<typeof generatedSpecSchema>;
|
|
330
|
+
export type GeneratedSpecResult = z.ZodSafeParseResult<GeneratedSpec>;
|
|
330
331
|
/** How a spec came to exist. Surfaced for benchmarking and observability. */
|
|
331
332
|
export type SpecSource = 'llm' | 'cache' | 'fallback';
|
|
332
333
|
/**
|
|
@@ -373,54 +374,6 @@ export interface ComponentSpec extends GeneratedSpec {
|
|
|
373
374
|
/** Throws a `ZodError` if the value is not a well-formed generated spec. */
|
|
374
375
|
export declare function parseGeneratedSpec(value: unknown): GeneratedSpec;
|
|
375
376
|
/** Non-throwing variant, for validating untrusted model output. */
|
|
376
|
-
export declare function safeParseGeneratedSpec(value: unknown):
|
|
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
|
-
}>;
|
|
377
|
+
export declare function safeParseGeneratedSpec(value: unknown): GeneratedSpecResult;
|
|
425
378
|
export {};
|
|
426
379
|
//# 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;AAC7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AAEtE,6EAA6E;AAC7E,MAAM,MAAM,UAAU,GAAG,KAAK,GAAG,OAAO,GAAG,UAAU,CAAC;AAEtD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc;AACxB,6DAA6D;AAC3D,aAAa;AACf,mEAAmE;GACjE,gBAAgB;AAClB,mDAAmD;GACjD,SAAS;AACX,2DAA2D;GACzD,oBAAoB;AACtB,mEAAmE;GACjE,mBAAmB;AACrB,mEAAmE;GACjE,WAAW,CAAC;AAEhB,eAAO,MAAM,YAAY,EAAG,GAAY,CAAC;AAEzC,kFAAkF;AAClF,MAAM,WAAW,aAAc,SAAQ,aAAa;IAClD,WAAW,EAAE,OAAO,YAAY,CAAC;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,UAAU,CAAC;IACnB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,4DAA4D;IAC5D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;;;OAIG;IACH,cAAc,CAAC,EAAE,cAAc,CAAC;CACjC;AAED,4EAA4E;AAC5E,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAEhE;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,CAE1E"}
|
package/dist/component-spec.js
CHANGED
|
@@ -71,20 +71,9 @@ export const RECOMMENDATION_BASES = [
|
|
|
71
71
|
export const productReferenceSchema = z.object({
|
|
72
72
|
/** Must be a SKU the host supplied in `TrackingInput.candidates`. */
|
|
73
73
|
sku: z.string(),
|
|
74
|
-
/**
|
|
75
|
-
* The strategy behind this pick. Reconciliation checks it against the
|
|
76
|
-
* shopper's signals, so the model cannot assert a relationship that is not
|
|
77
|
-
* there.
|
|
78
|
-
*/
|
|
74
|
+
/** Checked against the shopper's signals, so the model cannot assert a pick it did not earn. */
|
|
79
75
|
basis: z.enum(RECOMMENDATION_BASES),
|
|
80
|
-
/**
|
|
81
|
-
* How the basis is phrased for the shopper, e.g. "Pairs with the boots you
|
|
82
|
-
* bought". Free text, but it has to be consistent with `basis`, which is not.
|
|
83
|
-
*
|
|
84
|
-
* Nullable because reconciliation clears it when it cannot verify the basis:
|
|
85
|
-
* a pick may still be worth showing when the stated reason for it is not
|
|
86
|
-
* true, but the prose asserting that reason must not render.
|
|
87
|
-
*/
|
|
76
|
+
/** How the basis is phrased, e.g. "Pairs with the boots you bought". Null once unverifiable. */
|
|
88
77
|
reason: z.string().nullable(),
|
|
89
78
|
/** Short accent label, e.g. "Worth a look". Null when nothing warrants one. */
|
|
90
79
|
badge: z.string().nullable(),
|
|
@@ -152,10 +141,7 @@ export const generatedSpecSchema = z.object({
|
|
|
152
141
|
headline: z.string(),
|
|
153
142
|
subheadline: z.string().nullable(),
|
|
154
143
|
blocks: z.array(blockSchema),
|
|
155
|
-
/**
|
|
156
|
-
* One sentence on why this arrangement was chosen. For engineers reading
|
|
157
|
-
* generation logs, not for shoppers; it is not rendered by default.
|
|
158
|
-
*/
|
|
144
|
+
/** One sentence for generation logs, not for shoppers. Not rendered by default. */
|
|
159
145
|
rationale: z.string(),
|
|
160
146
|
});
|
|
161
147
|
export const SPEC_VERSION = '1';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-spec.js","sourceRoot":"","sources":["../src/component-spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,sCAAsC;AACtC,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,SAAS,EAAE,cAAc,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAEjF,iCAAiC;AACjC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAM,EAAE,OA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EH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IACtD,eAAe;IACf,eAAe;IACf,mBAAmB;IACnB,iBAAiB;IACjB,eAAe;IACf,iBAAiB;CAClB,CAAC,CAAC;AAWH;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC;IAC5B,mFAAmF;IACnF,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE;CACtB,CAAC,CAAC;AA4BH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAY,CAAC;AAuBzC,4EAA4E;AAC5E,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO,mBAAmB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AAC1C,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,OAAO,mBAAmB,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -7,6 +7,9 @@ import type { TrackingInput } from './tracking-input.js';
|
|
|
7
7
|
* no blocks only when there is genuinely nothing in stock left to show, which
|
|
8
8
|
* the renderer treats as "render nothing" — an empty recommendation region is
|
|
9
9
|
* worse than none.
|
|
10
|
+
*
|
|
11
|
+
* Reads the same digest and selector the model path does, so a degraded render is
|
|
12
|
+
* a weaker version of the same decision rather than an unrelated one.
|
|
10
13
|
*/
|
|
11
14
|
export declare function buildFallbackSpec(input: TrackingInput, digest: SignalDigest, options?: SelectOptions): GeneratedSpec;
|
|
12
15
|
//# sourceMappingURL=fallback-component.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-component.d.ts","sourceRoot":"","sources":["../src/fallback-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAkB,KAAK,aAAa,EAAoB,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"fallback-component.d.ts","sourceRoot":"","sources":["../src/fallback-component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAkB,KAAK,aAAa,EAAoB,MAAM,wBAAwB,CAAC;AAC9F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAoCzD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,YAAY,EACpB,OAAO,GAAE,aAAkB,GAC1B,aAAa,CAiBf"}
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
import { selectProducts } from './product-selection.js';
|
|
2
|
-
/**
|
|
3
|
-
* The deterministic component — what renders when no model does.
|
|
4
|
-
*
|
|
5
|
-
* The manuscript names data latency as the central risk of moving
|
|
6
|
-
* personalisation onto the server path: any delay in the recommendation engine
|
|
7
|
-
* blocks the page. This module is the answer. It is pure, synchronous, and
|
|
8
|
-
* cannot fail, so the server always has something correct to render — whether
|
|
9
|
-
* the model is slow, erroring, rate-limited, or simply not configured.
|
|
10
|
-
*
|
|
11
|
-
* It reads the same digest and uses the same selector the model path does, so a
|
|
12
|
-
* degraded render is a weaker version of the same decision rather than an
|
|
13
|
-
* unrelated one. Only the presentation is fixed.
|
|
14
|
-
*/
|
|
15
2
|
/** A featured lead only reads as deliberate when something follows it. */
|
|
16
3
|
const MIN_PICKS_FOR_A_FEATURED_LEAD = 3;
|
|
17
4
|
function headlineFor(digest) {
|
|
@@ -49,6 +36,9 @@ function toProductReference(pick, index, total) {
|
|
|
49
36
|
* no blocks only when there is genuinely nothing in stock left to show, which
|
|
50
37
|
* the renderer treats as "render nothing" — an empty recommendation region is
|
|
51
38
|
* worse than none.
|
|
39
|
+
*
|
|
40
|
+
* Reads the same digest and selector the model path does, so a degraded render is
|
|
41
|
+
* a weaker version of the same decision rather than an unrelated one.
|
|
52
42
|
*/
|
|
53
43
|
export function buildFallbackSpec(input, digest, options = {}) {
|
|
54
44
|
const picks = selectProducts(input, digest, options).slice(0, digest.maxItems);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fallback-component.js","sourceRoot":"","sources":["../src/fallback-component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwC,MAAM,wBAAwB,CAAC;AAG9F
|
|
1
|
+
{"version":3,"file":"fallback-component.js","sourceRoot":"","sources":["../src/fallback-component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAwC,MAAM,wBAAwB,CAAC;AAG9F,0EAA0E;AAC1E,MAAM,6BAA6B,GAAG,CAAC,CAAC;AAExC,SAAS,WAAW,CAAC,MAAoB;IACvC,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;QACvB,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAC9D,CAAC;IACD,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC;IAChE,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC;I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AExF,OAAO;QACL,IAAI,EAAE,SAAS;QACf,QAAQ;QACR,WAAW;QACX,MAAM,EACJ,KAAK,CAAC,MAAM,KAAK,CAAC;YAChB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAE,CAAC;QAC/E,SAAS,EAAE,MAAM,CAAC,WAAW;YAC3B,CAAC,CAAC,oEAAoE;YACtE,CAAC,CAAC,8EAA8E;KACnF,CAAC;AACJ,CAAC"}
|
package/dist/fit-to-shopper.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import type { GeneratedSpec } from './component-spec.js';
|
|
2
2
|
import type { ProductPick } from './product-selection.js';
|
|
3
|
-
export
|
|
3
|
+
export interface FittedSpec {
|
|
4
|
+
spec: GeneratedSpec;
|
|
5
|
+
ourReasons: Map<string, string>;
|
|
6
|
+
}
|
|
7
|
+
export declare function fitToShopper(spec: GeneratedSpec, picks: readonly ProductPick[], maxItems: number): FittedSpec;
|
|
4
8
|
//# sourceMappingURL=fit-to-shopper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fit-to-shopper.d.ts","sourceRoot":"","sources":["../src/fit-to-shopper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"fit-to-shopper.d.ts","sourceRoot":"","sources":["../src/fit-to-shopper.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,aAAa,EAAoB,MAAM,qBAAqB,CAAC;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,aAAa,CAAC;IACpB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAID,wBAAgB,YAAY,CAC1B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,SAAS,WAAW,EAAE,EAC7B,QAAQ,EAAE,MAAM,GACf,UAAU,CAuCZ"}
|
package/dist/fit-to-shopper.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
// The model picks the shape. Selection picks the grid and carousel products and
|
|
2
2
|
// what may be said about them, so a shared component still fits one shopper.
|
|
3
|
-
export function fitToShopper(spec, picks, maxItems
|
|
3
|
+
export function fitToShopper(spec, picks, maxItems) {
|
|
4
4
|
// Picks are ordered best first. Every slot takes the next one.
|
|
5
5
|
let next = 0;
|
|
6
6
|
const limit = Math.min(picks.length, maxItems);
|
|
7
|
+
const ourReasons = new Map();
|
|
7
8
|
const blocks = [];
|
|
8
9
|
for (const block of spec.blocks) {
|
|
9
10
|
// A hero is left alone. Its headline and body were written about the
|
|
@@ -16,8 +17,9 @@ export function fitToShopper(spec, picks, maxItems, hostReasonSkus) {
|
|
|
16
17
|
if (next >= limit)
|
|
17
18
|
break; // shrink, never pad
|
|
18
19
|
const chosen = picks[next];
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
// Every reason here is written by this library or handed to it by the
|
|
21
|
+
// shop. None of them is the model's, whatever the model wrote in this slot.
|
|
22
|
+
ourReasons.set(chosen.product.sku, chosen.reason);
|
|
21
23
|
items.push({
|
|
22
24
|
sku: chosen.product.sku,
|
|
23
25
|
basis: chosen.basis,
|
|
@@ -33,6 +35,6 @@ export function fitToShopper(spec, picks, maxItems, hostReasonSkus) {
|
|
|
33
35
|
}
|
|
34
36
|
blocks.push(block);
|
|
35
37
|
}
|
|
36
|
-
return { ...spec, blocks };
|
|
38
|
+
return { spec: { ...spec, blocks }, ourReasons };
|
|
37
39
|
}
|
|
38
40
|
//# sourceMappingURL=fit-to-shopper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fit-to-shopper.js","sourceRoot":"","sources":["../src/fit-to-shopper.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fit-to-shopper.js","sourceRoot":"","sources":["../src/fit-to-shopper.ts"],"names":[],"mappings":"AAQA,gFAAgF;AAChF,6EAA6E;AAC7E,MAAM,UAAU,YAAY,CAC1B,IAAmB,EACnB,KAA6B,EAC7B,QAAgB;IAEhB,+DAA+D;IAC/D,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE/C,MAAM,UAAU,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC7C,MAAM,MAAM,GAAY,EAAE,CAAC;IAC3B,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChC,qEAAqE;QACrE,4EAA4E;QAC5E,2EAA2E;QAC3E,oCAAoC;QAEpC,IAAI,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;YACvD,MAAM,KAAK,GAAuB,EAAE,CAAC;YACrC,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,KAAK,EAAE,CAAC;gBAC/B,IAAI,IAAI,IAAI,KAAK;oBAAE,MAAM,CAAC,oBAAoB;gBAC9C,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAE,CAAC;gBAC5B,sEAAsE;gBACtE,4EAA4E;gBAC5E,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;gBAClD,KAAK,CAAC,IAAI,CAAC;oBACT,GAAG,EAAE,MAAM,CAAC,OAAO,CAAC,GAAG;oBACvB,KAAK,EAAE,MAAM,CAAC,KAAK;oBACnB,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,mDAAmD;oBACnD,KAAK,EAAE,IAAI;oBACX,QAAQ,EAAE,IAAI,CAAC,QAAQ;iBACxB,CAAC,CAAC;gBACH,IAAI,IAAI,CAAC,CAAC;YACZ,CAAC;YACD,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;YACjC,SAAS;QACX,CAAC;QAED,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrB,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,EAAE,UAAU,EAAE,CAAC;AACnD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { FIELD_LIMITS, productSchema, skuSignalSchema, viewSignalSchema, purchaseSignalSchema, interactionSchema, renderContextSchema, trackingSignalsSchema, bundleSchema, trackingInputSchema, parseTrackingInput, safeParseTrackingInput, type Product, type SkuSignal, type ViewSignal, type PurchaseSignal, type Interaction, type RenderContext, type TrackingSignals, type Bundle, type TrackingInput, type TrackingInputDraft, type TrackingInputResult, } from './tracking-input.js';
|
|
9
9
|
export { DIGEST_LIMITS, buildDigest, toCohortDigest, type CategoryAffinity, type InteractionCount, type SignalDigest, type ViewedProduct, } from './signal-digest.js';
|
|
10
|
-
export { BANNER_TONES, EMPHASIS, RECOMMENDATION_BASES, SPEC_VERSION, TONES, blockSchema, generatedSpecSchema, parseGeneratedSpec, productReferenceSchema, safeParseGeneratedSpec, type BannerBlock, type Block, type BlockKind, type BundleBlock, type CarouselBlock, type ComponentSpec, type CopyBlock, type GeneratedSpec, type GridBlock, type HeroBlock, type ProductReference, type RecommendationBasis, type DegradedReason, type SpecSource, } from './component-spec.js';
|
|
10
|
+
export { BANNER_TONES, EMPHASIS, RECOMMENDATION_BASES, SPEC_VERSION, TONES, blockSchema, generatedSpecSchema, parseGeneratedSpec, productReferenceSchema, safeParseGeneratedSpec, type BannerBlock, type Block, type BlockKind, type BundleBlock, type CarouselBlock, type ComponentSpec, type CopyBlock, type GeneratedSpec, type GeneratedSpecResult, type GridBlock, type HeroBlock, type ProductReference, type RecommendationBasis, type DegradedReason, type SpecSource, } from './component-spec.js';
|
|
11
11
|
export { reconcileSpec, type ReconcileResult } from './reconciliation.js';
|
|
12
12
|
export { selectProducts, type ProductPick } from './product-selection.js';
|
|
13
13
|
export { createFixedSpecProvider, type ComponentProvider, type ProviderRequest, type ProviderResult, type TokenUsage, } from './provider.js';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,a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"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GAYvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,GAKf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,GAYvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,GAKf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,YAAY,EACZ,QAAQ,EACR,oBAAoB,EACpB,YAAY,EACZ,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,sBAAsB,EACtB,sBAAsB,GAgBvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,aAAa,EAAwB,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAoB,MAAM,wBAAwB,CAAC;AAE1E,OAAO,EACL,uBAAuB,GAKxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,qBAAqB,EACrB,mBAAmB,GAIpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EACL,wBAAwB,GAIzB,MAAM,0BAA0B,CAAC"}
|
package/dist/model-prompt.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SignalDigest } from './signal-digest.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type Product, type TrackingInput } from './tracking-input.js';
|
|
3
3
|
/**
|
|
4
4
|
* What actually reaches the model.
|
|
5
5
|
*
|
|
@@ -25,5 +25,17 @@ export interface PromptPair {
|
|
|
25
25
|
user: string;
|
|
26
26
|
}
|
|
27
27
|
export declare const SYSTEM_PROMPT: string;
|
|
28
|
+
/**
|
|
29
|
+
* The candidates the model is actually shown.
|
|
30
|
+
*
|
|
31
|
+
* An out-of-stock product is dropped during reconciliation whatever the model
|
|
32
|
+
* does with it, so offering one only costs the shopper a slot.
|
|
33
|
+
*
|
|
34
|
+
* Exported because reconciliation checks the numerals the model writes against
|
|
35
|
+
* the strings on this list, and a candidate it was never shown cannot be where
|
|
36
|
+
* one came from. Two copies of "what the model saw" would drift, and the pair
|
|
37
|
+
* that drifted would be the prompt and the screen reading it back.
|
|
38
|
+
*/
|
|
39
|
+
export declare function offeredCandidates(input: TrackingInput): Product[];
|
|
28
40
|
export declare function buildPrompt(input: TrackingInput, digest: SignalDigest): PromptPair;
|
|
29
41
|
//# sourceMappingURL=model-prompt.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-prompt.d.ts","sourceRoot":"","sources":["../src/model-prompt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"model-prompt.d.ts","sourceRoot":"","sources":["../src/model-prompt.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAgB,KAAK,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErF;;;;;;;;;;;;;;;GAeG;AAEH,eAAO,MAAM,eAAe,yBAAyB,CAAC;AACtD,eAAO,MAAM,aAAa,uBAAuB,CAAC;AAElD,MAAM,WAAW,UAAU;IACzB,4DAA4D;IAC5D,MAAM,EAAE,MAAM,CAAC;IACf,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;CACd;AAID,eAAO,MAAM,aAAa,QA6FtB,CAAC;AA6HL;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,EAAE,CAEjE;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,GAAG,UAAU,CA0BlF"}
|