@rudra-js/core 0.5.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 +51 -4
- 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 +32 -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 +4 -3
- 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 +1 -1
- package/dist/model-prompt.d.ts.map +1 -1
- package/dist/model-prompt.js +38 -18
- package/dist/model-prompt.js.map +1 -1
- package/dist/product-selection.d.ts +0 -6
- package/dist/product-selection.d.ts.map +1 -1
- package/dist/product-selection.js +1 -3
- 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 +10 -22
- package/dist/reconciliation.d.ts.map +1 -1
- package/dist/reconciliation.js +116 -399
- 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 -4
- package/src/claim-screening.ts +242 -0
- package/src/component-generator.ts +37 -123
- package/src/component-spec.ts +5 -18
- package/src/fallback-component.ts +3 -14
- package/src/fit-to-shopper.ts +9 -4
- package/src/index.ts +1 -0
- package/src/model-prompt.ts +42 -20
- package/src/product-selection.ts +1 -9
- package/src/provider.ts +1 -8
- package/src/reconciliation.ts +135 -430
- package/src/signal-digest.ts +41 -31
- package/src/spec-cache.ts +27 -24
- package/src/tracking-input.ts +16 -13
package/dist/reconciliation.d.ts
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import type { Block, GeneratedSpec } from './component-spec.js';
|
|
2
|
-
import type
|
|
3
|
-
import type { Bundle,
|
|
4
|
-
/**
|
|
5
|
-
* More than this and the component stops being a component.
|
|
6
|
-
*
|
|
7
|
-
* Exported because the fill pass has to read the same blocks this module will:
|
|
8
|
-
* one past the cap never renders, so nothing is worth reserving for it.
|
|
9
|
-
*/
|
|
2
|
+
import { type SignalDigest } from './signal-digest.js';
|
|
3
|
+
import type { Bundle, TrackingInput } from './tracking-input.js';
|
|
4
|
+
/** More than this and the component stops being a component. */
|
|
10
5
|
export declare const MAX_BLOCKS = 4;
|
|
6
|
+
/** The fill pass calls this too: one past the cap never renders, so nothing is worth reserving for it. */
|
|
7
|
+
export declare function capBlocks(blocks: Block[]): Block[];
|
|
11
8
|
export interface ReconcileResult {
|
|
12
9
|
spec: GeneratedSpec;
|
|
13
10
|
/** True when something survived that is worth rendering. */
|
|
@@ -18,24 +15,15 @@ export interface ReconcileResult {
|
|
|
18
15
|
/**
|
|
19
16
|
* SKUs that must never be recommended, whatever chose them.
|
|
20
17
|
*
|
|
18
|
+
* Everything above plus what the shopper already has, read from the payload for
|
|
19
|
+
* the same reason: a shopper with nine purchases must not be sold the ninth back.
|
|
20
|
+
*
|
|
21
21
|
* Exported because the deterministic selector applies the same rule when it
|
|
22
22
|
* picks. Two copies of "never recommend these" would drift, and the pair that
|
|
23
23
|
* drifted would be the model path and the fallback path — the two whose
|
|
24
24
|
* comparability the whole evaluation depends on.
|
|
25
25
|
*/
|
|
26
|
-
export declare function neverRecommend(
|
|
27
|
-
/**
|
|
28
|
-
* Wording attested bans that this project has already ruled is not a claim. An allowance
|
|
29
|
-
* forgives a banned phrase sitting inside it, so an entry ending on a preposition — "extra
|
|
30
|
-
* clearance for" — forgives whatever follows it. Exported so a test can hold the list
|
|
31
|
-
* against attested's own.
|
|
32
|
-
*/
|
|
33
|
-
export declare const ALLOWED_PHRASES: string[];
|
|
34
|
-
/**
|
|
35
|
-
* The numbers the shop published about one product: its category and tags, only the strings
|
|
36
|
-
* carrying a digit. Exported so a test can pin what never reaches attested.
|
|
37
|
-
*/
|
|
38
|
-
export declare function productFacts(product: Product): string[];
|
|
26
|
+
export declare function neverRecommend(input: TrackingInput): Set<string>;
|
|
39
27
|
/**
|
|
40
28
|
* The set this shopper should get, decided before anything is placed.
|
|
41
29
|
*
|
|
@@ -56,7 +44,7 @@ export declare function bundleForShopper(input: TrackingInput, digest: SignalDig
|
|
|
56
44
|
* One this shopper cannot see is dropped below and spends nothing, so it is not
|
|
57
45
|
* counted here either.
|
|
58
46
|
*/
|
|
59
|
-
export declare function placeableHeroSkus(blocks: readonly Block[], input: TrackingInput
|
|
47
|
+
export declare function placeableHeroSkus(blocks: readonly Block[], input: TrackingInput): string[];
|
|
60
48
|
export declare function reconcileSpec(generated: GeneratedSpec, input: TrackingInput, digest: SignalDigest,
|
|
61
49
|
/**
|
|
62
50
|
* The reason this request wrote itself, by SKU: the host's own `reason` on a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconciliation.d.ts","sourceRoot":"","sources":["../src/reconciliation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,KAAK,EACL,a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