@instruments/materialgraph 0.26.0 → 0.27.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 (113) hide show
  1. package/association-types.d.ts +18 -7
  2. package/attribution-types.d.ts +2 -2
  3. package/brand-types.d.ts +8 -0
  4. package/brands-client.d.ts +5 -36
  5. package/brands-client.js +7 -33
  6. package/by-colour-types.d.ts +40 -13
  7. package/by-spec-types.d.ts +0 -67
  8. package/by-spec-types.js +7 -5
  9. package/catalog-discovery-types.d.ts +1 -16
  10. package/catalogue-client.d.ts +12 -31
  11. package/catalogue-client.js +10 -46
  12. package/catalogue-types.d.ts +40 -0
  13. package/categories-client.d.ts +63 -0
  14. package/categories-client.js +48 -0
  15. package/category-types.d.ts +114 -0
  16. package/client-config.d.ts +2 -4
  17. package/client-config.js +2 -4
  18. package/client-vocabulary.d.ts +2 -4
  19. package/client-vocabulary.js +11 -9
  20. package/client.d.ts +103 -203
  21. package/client.js +126 -251
  22. package/codes-types.d.ts +21 -0
  23. package/colours-client.d.ts +4 -9
  24. package/colours-client.js +0 -8
  25. package/errors.d.ts +1 -1
  26. package/errors.js +1 -0
  27. package/identify-types.d.ts +49 -39
  28. package/identify-types.js +5 -3
  29. package/index.d.ts +11 -21
  30. package/index.js +4 -4
  31. package/list-variant-facets-types.d.ts +60 -0
  32. package/list-variants-types.d.ts +142 -0
  33. package/list-variants-types.js +12 -0
  34. package/match-stream-types.d.ts +13 -0
  35. package/match-stream-types.js +2 -0
  36. package/match-stream.js +12 -8
  37. package/match-types.d.ts +24 -0
  38. package/material-asset-types.d.ts +69 -49
  39. package/material-block-types.d.ts +2 -0
  40. package/material-composition-client.d.ts +21 -0
  41. package/material-composition-client.js +13 -0
  42. package/material-composition-types.d.ts +403 -0
  43. package/material-query-plan-types.d.ts +57 -141
  44. package/material-resources-client.d.ts +9 -7
  45. package/material-resources-client.js +19 -4
  46. package/material-types.d.ts +6 -14
  47. package/operations.d.ts +1 -1
  48. package/operations.js +20 -117
  49. package/package.json +5 -1
  50. package/palette-search-types.d.ts +59 -24
  51. package/query-understanding-types.d.ts +27 -5
  52. package/resolve-client.d.ts +6 -10
  53. package/resolve-client.js +5 -7
  54. package/response-schemas.d.ts +20 -0
  55. package/response-schemas.generated.d.ts +5 -0
  56. package/response-schemas.generated.js +160 -0
  57. package/response-schemas.js +113 -0
  58. package/run-types.d.ts +12 -93
  59. package/runs.d.ts +1 -37
  60. package/runs.js +2 -79
  61. package/schema-resource-types.d.ts +14 -1
  62. package/search-card-types.d.ts +22 -0
  63. package/search-index-plan-types.d.ts +70 -0
  64. package/search-refinement-types.d.ts +8 -38
  65. package/search-refinement-types.js +1 -0
  66. package/search-request-types.d.ts +117 -200
  67. package/search-response-receipt-types.d.ts +12 -268
  68. package/search-result-validation.d.ts +0 -16
  69. package/search-result-validation.js +22 -180
  70. package/spec-facet-types.d.ts +3 -8
  71. package/spec-types.d.ts +17 -10
  72. package/spec-types.js +8 -7
  73. package/specifications.d.ts +13 -55
  74. package/specifications.js +29 -73
  75. package/suggest-types.d.ts +4 -10
  76. package/suggest-types.js +1 -1
  77. package/types.d.ts +135 -338
  78. package/webmcp.d.ts +1 -1
  79. package/webmcp.generated.js +10 -94
  80. package/brand-most-sampled-types.d.ts +0 -33
  81. package/browse-types.d.ts +0 -236
  82. package/client-browse.d.ts +0 -78
  83. package/client-browse.js +0 -71
  84. package/client-exploration.d.ts +0 -9
  85. package/client-exploration.js +0 -5
  86. package/compare-types.d.ts +0 -89
  87. package/composition-client.d.ts +0 -33
  88. package/composition-client.js +0 -28
  89. package/composition-types.d.ts +0 -455
  90. package/composition-types.js +0 -10
  91. package/correction-types.d.ts +0 -88
  92. package/exploration-types.d.ts +0 -118
  93. package/exploration-types.js +0 -1
  94. package/fan-deck-types.d.ts +0 -42
  95. package/fan-deck-types.js +0 -9
  96. package/match-rejection-types.d.ts +0 -43
  97. package/match-rejection-types.js +0 -7
  98. package/palette-completion-types.d.ts +0 -115
  99. package/palette-completion-types.js +0 -1
  100. package/render-assets-types.d.ts +0 -65
  101. package/render-assets-types.js +0 -1
  102. package/search-collapse-types.d.ts +0 -69
  103. package/search-collapse-types.js +0 -1
  104. package/search-mood-types.d.ts +0 -6
  105. package/search-mood-types.js +0 -1
  106. package/search-window-types.d.ts +0 -25
  107. package/search-window-types.js +0 -1
  108. package/slot-pool-types.d.ts +0 -372
  109. package/slot-pool-types.js +0 -1
  110. /package/{brand-most-sampled-types.js → category-types.js} +0 -0
  111. /package/{browse-types.js → list-variant-facets-types.js} +0 -0
  112. /package/{compare-types.js → material-composition-types.js} +0 -0
  113. /package/{correction-types.js → search-index-plan-types.js} +0 -0
@@ -1,455 +0,0 @@
1
- /**
2
- * Hand-mirrored wire types for the synchronous composition-variation surface
3
- * (`POST /api/v1/schemes/vary`, operation `vary_schemes`, MG-438). Like the rest
4
- * of the SDK these interfaces carry NO runtime dependency on any
5
- * `@materialgraph/*` package — they mirror the `VarySchemesRequest` /
6
- * `VarySchemesResponse` shapes in `apps/web/public/openapi.yaml`.
7
- *
8
- * Vary is deterministic and synchronous: it re-derives an "option B" from a
9
- * succeeded `compose-material-schemes` Run along one constraint axis, so unlike
10
- * the async Run surface the response IS the scheme — no run envelope, no events.
11
- *
12
- * TOLERANT-PARSING CONTRACT: response enums are widened with {@link OpenEnum}
13
- * so a new server value still type-checks; objects are read structurally.
14
- */
15
- import type { VerdictCitation } from "./citation-types.js";
16
- import type { RunId, SchemeId, SlotId, VariantId } from "./identifiers.js";
17
- import type { OpenEnum } from "./types.js";
18
- /**
19
- * The four v1 variation axes. Request-side, so this is a STRICT union (the
20
- * caller picks exactly one). `uniqueness` is deferred server-side (MG-445).
21
- */
22
- export type VaryAxis = "palette" | "sustainability" | "brandDiversity" | "priceTier";
23
- /**
24
- * The variation axes as a runtime array, for consumers that render an axis
25
- * picker. Order is the canonical presentation order.
26
- */
27
- export declare const VARY_AXES: readonly VaryAxis[];
28
- /** Pin one slot to a specific variant so vary re-derives only the rest. */
29
- export interface SchemeLock {
30
- slotId: SlotId;
31
- /** Must equal that slot's CURRENT pick in the source scheme. Opaque. */
32
- variantId: VariantId;
33
- }
34
- /** Candidate exclusions applied on top of the automatic source-pick exclusion. */
35
- export interface SchemeExclusions {
36
- /** Opaque variant ids to keep out of every slot. */
37
- variantIds?: VariantId[];
38
- brandSlugs?: string[];
39
- }
40
- /** Body for `POST /api/v1/schemes/vary` ({@link MaterialGraphClient.varyScheme}). */
41
- export interface VarySchemesRequest {
42
- /** The succeeded `compose-material-schemes` Run to vary from. Opaque. */
43
- runId: RunId;
44
- /** Which scheme in the Run is option A. Defaults to the Run's FIRST scheme. */
45
- schemeId?: SchemeId;
46
- axis: VaryAxis;
47
- /** Slots kept pinned to their source pick; only unlocked slots re-derive. */
48
- locks?: SchemeLock[];
49
- exclusions?: SchemeExclusions;
50
- }
51
- /**
52
- * One anchor (MG-613): a variant the designer has already pinned to a place in
53
- * the programme, supplied on the `compose-material-schemes` run input's
54
- * `anchors[]`. Exactly ONE of `variantId` (an exact catalog variant) or `query`
55
- * (free-text "Brand Product Colour", resolved server-side) is required. An
56
- * anchored slot is LOCKED — composition completes the OPEN slots in relation to
57
- * it. Anchors that cannot be resolved leave the slot open and surface a run
58
- * warning (never a failure).
59
- */
60
- export interface ComposeAnchorInput {
61
- /** The building element the anchor fills (flooring, wall, textile, …). */
62
- element: SlotElement;
63
- /** Optional named space to scope the anchor to (matched by name/slug). */
64
- spaceName?: string;
65
- /** An exact catalog variant id. Opaque. Mutually exclusive with `query`. */
66
- variantId?: VariantId;
67
- /** Free-text "Brand Product Colour". Mutually exclusive with `variantId`. */
68
- query?: string;
69
- /** Display name for slot naming and warnings. */
70
- label?: string;
71
- }
72
- /**
73
- * One standing rule in a project's compliance preset (MG-615): free-text
74
- * `criteria` phrases that apply to a `scope` of slots. `scope: "all"` reaches
75
- * every slot (including slots with no element and slots classified `other`); a
76
- * named element reaches only slots carrying exactly that element, so an
77
- * unclassified slot receives `"all"` rules only. Phrases are resolved
78
- * server-side through the same vocabulary as brief criteria — sustainability
79
- * wording ("LEED", "GREENGUARD Gold") resolves to a named certification
80
- * programme. A phrase that grounds to nothing is dropped with a run warning.
81
- */
82
- export interface CompliancePresetRule {
83
- scope: "all" | SlotElement;
84
- criteria: string[];
85
- }
86
- /** A project's standing rules, declared once on the compose run (max 12 rules). */
87
- export interface CompliancePreset {
88
- rules: CompliancePresetRule[];
89
- }
90
- /** Exact project regulatory axes used to attach bounded code citations. */
91
- export interface ProgrammeRegulatoryAxes {
92
- jurisdictionId: string;
93
- occupancyGroup: string;
94
- sprinklered: boolean;
95
- }
96
- /** One caller-declared Programme space. `spaceType` remains open descriptive text. */
97
- export interface ComposeDeclaredSpace {
98
- name: string;
99
- spaceType?: string;
100
- /** Exact active canonical `room` id used for bounded code evaluation. */
101
- regulatoryRoomType?: string;
102
- }
103
- /** The spaces this run is explicitly for; omit to retain brief inference. */
104
- export interface ComposeDeclaredScope {
105
- spaces: ComposeDeclaredSpace[];
106
- }
107
- /**
108
- * The `inputJson` for a `compose-material-schemes` run. `batchId` is required;
109
- * everything else has a server default. `anchors` (max 24) carry externally
110
- * decided picks (MG-613); `compliancePreset` carries the project's standing
111
- * rules (MG-615), which cascade into slots as PREFERRED criteria — they grade
112
- * every candidate but never exclude one.
113
- */
114
- export interface ComposeMaterialSchemesInput {
115
- /** The uploaded source-material batch to compose from. Opaque. */
116
- batchId: string;
117
- count?: number;
118
- seed?: number;
119
- exclusions?: SchemeExclusions;
120
- anchors?: ComposeAnchorInput[];
121
- compliancePreset?: CompliancePreset;
122
- /** Omit to leave Programme code coverage explicitly unevaluated. */
123
- regulatoryAxes?: ProgrammeRegulatoryAxes;
124
- /** Explicit caller-held space facts; regulatoryRoomType is never inferred. */
125
- scope?: ComposeDeclaredScope;
126
- }
127
- /**
128
- * The state of one criterion verdict cell (MG-627: the shared MaterialGraph
129
- * verdict states). The six LIVE states are `matched` (accepted value satisfies
130
- * the criterion), `deviated` (directionally off but named), `failed` (an
131
- * accepted value exists and does not satisfy it), `unverified` (a real value
132
- * that did not clear the trust bar), `missing` (no accepted value to evaluate),
133
- * and `not_evaluated` (the engine did not check it). `mismatched`/`unknown` are
134
- * the two LEGACY tokens old persisted runs still carry (never emitted again).
135
- * Open per the response-enum policy: treat unknown states forward-compatibly.
136
- */
137
- export type CompositionMatchState = OpenEnum<"matched" | "deviated" | "failed" | "unverified" | "missing" | "not_evaluated" | "mismatched" | "unknown">;
138
- /** How a criterion cell was baselined — what the candidate was compared against. */
139
- export type CompositionMatchBaseline = {
140
- kind: "term";
141
- term: string;
142
- } | {
143
- kind: "presence";
144
- } | {
145
- kind: "seed";
146
- variantId: string;
147
- };
148
- /** One resolved criterion → material verdict cell, as graded during composition. */
149
- export interface CompositionMatch {
150
- attributeId: string;
151
- state: CompositionMatchState;
152
- confidence: number | null;
153
- sourceBasis: string | null;
154
- /** Required vs preferred criterion (MG-627). Absent on legacy persisted runs. */
155
- strength?: "required" | "preferred";
156
- /** What the cell was evaluated against (MG-627). Absent on legacy persisted runs. */
157
- baseline?: CompositionMatchBaseline;
158
- /** The candidate's own accepted value label, when the cell carries one (MG-627). */
159
- value?: string | null;
160
- /** Why an `unverified` cell missed the trust bar (MG-627), else null. */
161
- trustGap?: "below_confidence" | "basis_unmet" | "proposed" | null;
162
- citation?: VerdictCitation;
163
- }
164
- /** One slot's chosen material plus the reason it was picked. */
165
- export interface CompositionPick {
166
- slotId: SlotId;
167
- slotName: string;
168
- spaceId?: string | null;
169
- element?: string | null;
170
- material: {
171
- /** Opaque — round-trip verbatim into the material lenses. */
172
- variantId: VariantId;
173
- brand: string;
174
- product: string;
175
- variant: string;
176
- imageUrl: string | null;
177
- hex: string | null;
178
- };
179
- reason: {
180
- score: number;
181
- matched: CompositionMatch[];
182
- notes: string[];
183
- };
184
- /**
185
- * True when this pick is an ANCHOR the designer pinned to the slot (MG-613):
186
- * composition never replaced it and vary keeps it fixed. Absent for ordinary
187
- * composed picks.
188
- */
189
- locked?: boolean;
190
- }
191
- /** The multi-objective score for one scheme (each component in [0, 1]). */
192
- export interface CompositionObjective {
193
- total: number;
194
- briefFit: number;
195
- coverage: number;
196
- coherence: number;
197
- novelty: number;
198
- }
199
- /** A hydrated scheme: one pick per slot, plus its objective breakdown. */
200
- export interface CompositionScheme {
201
- schemeId: SchemeId;
202
- title: string;
203
- picks: CompositionPick[];
204
- objective: CompositionObjective;
205
- }
206
- /**
207
- * How far short of the request the derivation fell, with honest reasons.
208
- * `produced < requested` is a real answer, not an error — `reasons` says why,
209
- * and a null shortfall means nothing fell short.
210
- */
211
- export interface CompositionShortfall {
212
- requested: number;
213
- produced: number;
214
- reasons: string[];
215
- }
216
- /** The axis + source provenance stamped onto every varied scheme. */
217
- export interface VaryProvenance {
218
- axis: VaryAxis;
219
- sourceRunId: RunId;
220
- sourceSchemeId: SchemeId;
221
- lockedSlotIds: SlotId[];
222
- /**
223
- * Human-readable notes recording exactly what the axis did — counts, not
224
- * adjectives (e.g. "brandDiversity: hard-excluded 2 brand(s) appearing ≥2×").
225
- * These are the variation's receipts.
226
- */
227
- notes: string[];
228
- }
229
- /** The `200` body from `POST /api/v1/schemes/vary`. */
230
- export interface VarySchemesResponse {
231
- /** The composition version the scheme was stamped with. */
232
- version: string;
233
- scheme: CompositionScheme;
234
- provenance: VaryProvenance;
235
- shortfall: CompositionShortfall | null;
236
- }
237
- /**
238
- * Whether a programme element (space, slot, or palette) was `stated` in a text
239
- * source or `inferred` from imagery/mood. Only inferred elements raise a review
240
- * question. Absent → treated as `stated`.
241
- */
242
- export type ProgrammeProvenance = "stated" | "inferred";
243
- /**
244
- * The broad building element a slot fills — a pragmatically-extended Uniclass EF
245
- * vocabulary. Widened with {@link OpenEnum} so a newer server term still
246
- * type-checks.
247
- */
248
- export type SlotElement = OpenEnum<"flooring" | "wall" | "ceiling" | "textile" | "surface" | "furniture" | "lighting" | "other">;
249
- /** One colour cue: a hex swatch with an optional human name. */
250
- export interface BriefColourCue {
251
- hex: string;
252
- name?: string;
253
- }
254
- /** A source anchor (document id + optional page) attributing derived content. */
255
- export interface CompositionSourceRef {
256
- sourceId: string;
257
- page: number | null;
258
- }
259
- /**
260
- * One candidate colour direction the pile's colour evidence implies when no
261
- * palette was explicitly committed. `directionId` is a stable kebab-case handle;
262
- * `sourceRefs` attribute the direction to the palette source(s) it was drawn
263
- * from (empty when unattributable).
264
- */
265
- export interface PaletteDirection {
266
- directionId: string;
267
- name: string;
268
- colours: BriefColourCue[];
269
- sourceRefs: CompositionSourceRef[];
270
- }
271
- /**
272
- * WHERE a slot's `category` came from (MG-954, extended MG-978): `resolved` —
273
- * derived from the slot's own words against the catalog's category vectors;
274
- * `resolved-coverage` — the words ended in a close race and the runner-up won it
275
- * because the text winner held no value for one of the slot's required
276
- * attributes; `model` — the interpreter's own draw stood because nothing
277
- * resolved; `none` — neither produced one, so the slot has NO category and
278
- * retrieval cannot gate it; `corrected` — a designer set it with a
279
- * `set-slot-category` correction. Widened with {@link OpenEnum} so a newer
280
- * server term still type-checks.
281
- */
282
- export type SlotCategorySource = OpenEnum<"resolved" | "resolved-coverage" | "model" | "none" | "corrected">;
283
- /**
284
- * Suspend payload for the compose `review-programme` step: the FULL programme
285
- * picture — every space and slot tagged with its provenance — so the card can
286
- * show the whole thing and highlight what was inferred.
287
- *
288
- * Each slot also discloses the catalog `category` it will shop in and the
289
- * `categorySource` that won it (MG-954). Both are OPTIONAL and additive: an
290
- * ABSENT `category` means the slot has none — not that it has an empty one — and
291
- * a slot in that state cannot be gated at retrieval, so it is skipped there with
292
- * a counted shortfall unless a `set-slot-category` correction supplies one.
293
- */
294
- export interface ReviewProgrammeSuspendPayload {
295
- spaces: {
296
- spaceId: string;
297
- name: string;
298
- spaceType?: string;
299
- provenance: ProgrammeProvenance;
300
- }[];
301
- slots: {
302
- slotId: string;
303
- name: string;
304
- spaceId?: string;
305
- element?: SlotElement;
306
- category?: string;
307
- categorySource?: SlotCategorySource;
308
- /** Criteria grounding exhausted its one bounded retry; absent otherwise. */
309
- groundingFailure?: {
310
- reason: "criteria-resolution-failed";
311
- };
312
- provenance: ProgrammeProvenance;
313
- }[];
314
- /**
315
- * Lines this room usually carries that the brief never named.
316
- *
317
- * Offered, never imposed: a programme that proceeds without them is a legal
318
- * answer. `essential` marks the ones whose absence makes the room unbuildable
319
- * as specified; `ffe` marks furniture and lighting the catalogue does not
320
- * serve yet, carried because a bedroom with no bed on the schedule is a gap
321
- * worth seeing coming. Add one with an `add-slot` correction.
322
- */
323
- unstated?: {
324
- spaceId: string;
325
- key: string;
326
- name: string;
327
- element: SlotElement;
328
- /**
329
- * Absent and `null` both mean the graph has no category for this line, and a
330
- * reader must treat them as one answer.
331
- *
332
- * The distinction does not survive the wire. A `null` set server-side
333
- * arrives as an absent key on the far side of the workflow runtime, so a
334
- * client that branched on which one it received would be reading transport
335
- * noise as meaning. An FF&E line the catalogue does not serve — a table
336
- * lamp, bed linen, ironmongery — has no category under either reading.
337
- */
338
- category?: string | null;
339
- weight: "essential" | "optional";
340
- ffe?: boolean;
341
- }[];
342
- }
343
- /**
344
- * Resume grammar for the `review-programme` step: drop a slot, drop a space
345
- * (cascade-dropping its slots), rename a space, or set a slot's category.
346
- *
347
- * `set-slot-category` (MG-954) is an action INSIDE this same corrections array;
348
- * its `category` must be one of the server's catalog category GROUP names (the
349
- * same vocabulary the payload's `category` is drawn from) or the resume is
350
- * refused. An empty `corrections` array stays legal however the step came to
351
- * suspend — the suspension discloses, it does not coerce.
352
- */
353
- export interface ReviewProgrammeResumeData {
354
- corrections: ({
355
- action: "drop-slot";
356
- slotId: string;
357
- } | {
358
- action: "drop-space";
359
- spaceId: string;
360
- } | {
361
- action: "rename-space";
362
- spaceId: string;
363
- name: string;
364
- } | {
365
- action: "set-slot-category";
366
- slotId: string;
367
- category: string;
368
- }
369
- /**
370
- * ADD a line the brief never named — usually one the payload offered under
371
- * `unstated`, though any line is legal. Every other verb here subtracts,
372
- * which made the programme a ceiling: whatever the brief happened to
373
- * mention was the most a schedule could ever contain.
374
- *
375
- * `category` may be null or absent, because some real lines — grout,
376
- * ironmongery, sanitaryware — have no catalog category yet. Such a slot is
377
- * skipped at retrieval with a counted `no-category` shortfall, which is the
378
- * honest treatment of a line we can hold but not yet fill.
379
- */
380
- | {
381
- action: "add-slot";
382
- spaceId: string;
383
- name: string;
384
- element: SlotElement;
385
- category?: string | null;
386
- })[];
387
- }
388
- /**
389
- * Suspend payload for the compose `commit-palette` step. Today only the
390
- * `directions` mode ships; the shape carries `mode` so a later `ab-images` mode
391
- * is an additive member, not a migration.
392
- */
393
- export interface CommitPaletteSuspendPayload {
394
- mode: OpenEnum<"directions">;
395
- directions: PaletteDirection[];
396
- }
397
- /**
398
- * Resume grammar for the `commit-palette` step: commit to one direction (by id)
399
- * or adopt the union of every direction's colours.
400
- */
401
- export type CommitPaletteResumeData = {
402
- choice: "direction";
403
- directionId: string;
404
- } | {
405
- choice: "all";
406
- };
407
- /**
408
- * Resume grammar for the `review-material-criteria` step: accept a resolved
409
- * attribute/term for an unresolved phrase, or drop it.
410
- */
411
- export interface ReviewCriteriaResumeData {
412
- corrections: ({
413
- action: "accept";
414
- slotId: string;
415
- raw: string;
416
- attributeId: string;
417
- term?: string;
418
- } | {
419
- action: "drop";
420
- slotId: string;
421
- raw: string;
422
- })[];
423
- }
424
- /** The union of every socratic-step resume payload, keyed by the suspended step. */
425
- export type InterviewResumeData = ReviewCriteriaResumeData | ReviewProgrammeResumeData | CommitPaletteResumeData;
426
- /** The three socratic interview steps, in procedure order. */
427
- export type InterviewStepId = "review-programme" | "commit-palette" | "review-material-criteria";
428
- /**
429
- * Payload of a `composition.answered` event — the pile answered a question with
430
- * no human turn, or a suspension resolved. `answer` is a stable slug; `citation`
431
- * attributes an answer to its source when the brief stated it.
432
- */
433
- export interface CompositionAnsweredPayload {
434
- step: InterviewStepId;
435
- answer: string;
436
- citation: CompositionSourceRef | null;
437
- counts?: Record<string, number>;
438
- }
439
- /**
440
- * Payload of a `composition.slot-pool` event — the candidate theater for one
441
- * slot: how many were considered and the top picks (≤5) hydrated for identity.
442
- */
443
- export interface SlotPoolEventPayload {
444
- slotId: SlotId;
445
- slotName: string;
446
- /** How many candidates were WEIGHED, not how many qualified. */
447
- considered: number;
448
- top: {
449
- variantId: VariantId;
450
- brand: string;
451
- product: string;
452
- imageUrl: string | null;
453
- score: number;
454
- }[];
455
- }
@@ -1,10 +0,0 @@
1
- /**
2
- * The variation axes as a runtime array, for consumers that render an axis
3
- * picker. Order is the canonical presentation order.
4
- */
5
- export const VARY_AXES = Object.freeze([
6
- "palette",
7
- "sustainability",
8
- "brandDiversity",
9
- "priceTier",
10
- ]);
@@ -1,88 +0,0 @@
1
- export type CorrectionJson = null | boolean | number | string | CorrectionJson[] | {
2
- [key: string]: CorrectionJson;
3
- };
4
- export type CorrectionSubject = {
5
- kind: "brand" | "product" | "variant";
6
- id: string;
7
- };
8
- export type CorrectionTarget = {
9
- kind: "identity";
10
- subject: CorrectionSubject;
11
- } | {
12
- kind: "attribute";
13
- subject: CorrectionSubject;
14
- blockId: string;
15
- attributeId: string;
16
- } | {
17
- kind: "relationship";
18
- subject: CorrectionSubject;
19
- relationship: string;
20
- relatedSubject: CorrectionSubject;
21
- } | {
22
- kind: "source_interpretation";
23
- sourceMaterialId: string;
24
- subject?: CorrectionSubject;
25
- } | {
26
- kind: "missing_record";
27
- url: string;
28
- };
29
- /** Caller-supplied evidence is not an independently verified graph reading. */
30
- export type CorrectionEvidence = {
31
- state: "known" | "unknown" | "conflicting" | "not_applicable";
32
- value?: CorrectionJson;
33
- sourceUrl?: string;
34
- note?: string;
35
- };
36
- export type CreateCorrectionInput = {
37
- target: CorrectionTarget;
38
- pageEvidence: CorrectionEvidence;
39
- graphEvidence: CorrectionEvidence;
40
- proposedChange: CorrectionJson;
41
- rationale: string;
42
- };
43
- export type Correction = {
44
- id: string;
45
- submission: CreateCorrectionInput;
46
- status: "submitted" | "in_review" | "resolved" | "withdrawn";
47
- resolution: "substantiated" | "not_substantiated" | "duplicate" | "superseded" | "cannot_determine" | null;
48
- createdAt: string;
49
- updatedAt: string;
50
- acceptedTruthChanged: false;
51
- };
52
- export type CorrectionResponse = {
53
- data: Correction;
54
- meta: {
55
- operationId: "corrections.create";
56
- requestId: string;
57
- idempotency: {
58
- replayed: boolean;
59
- };
60
- } | {
61
- operationId: "corrections.get";
62
- requestId: string;
63
- };
64
- links: {
65
- self: string;
66
- };
67
- warnings: never[];
68
- };
69
- export type CorrectionsListResponse = {
70
- data: Correction[];
71
- meta: {
72
- operationId: "corrections.list";
73
- requestId: string;
74
- page: {
75
- returned: number;
76
- total: {
77
- value: null;
78
- basis: "unavailable";
79
- };
80
- nextCursor: string | null;
81
- };
82
- };
83
- links: {
84
- self: string;
85
- next: string | null;
86
- };
87
- warnings: never[];
88
- };
@@ -1,118 +0,0 @@
1
- import type { CorpusScope, CorpusScopeReceipt } from "./corpus-scope-types.js";
2
- import type { VariantId } from "./identifiers.js";
3
- export type GraphOperator = "colourways" | "same_category" | "still_listed" | "looks_like" | "same_colour" | "pairs_with" | "often_specified_with" | "substitutes_for" | "more_durable" | "outdoor_suitable" | "lower_cost" | "more_sustainable";
4
- export type GraphOperatorAvailability = {
5
- operator: GraphOperator;
6
- operatorClass: "identity" | "perceptual" | "relational" | "spec";
7
- label: string;
8
- available: boolean;
9
- basis: string;
10
- discoverable: boolean;
11
- discoveryBasis: string;
12
- count?: number;
13
- };
14
- export type GraphOperatorEvidence = {
15
- variantId: VariantId;
16
- operators: GraphOperatorAvailability[];
17
- };
18
- export type CandidateReadInput = {
19
- operator: "looks_like";
20
- corpusScope?: CorpusScope;
21
- /** Return up to 24 ranked candidates (default 8), from one bounded retrieval. */
22
- limit?: number;
23
- excludeVariantIds?: VariantId[];
24
- };
25
- export type CandidateReadImage = {
26
- url: string;
27
- source: "r2" | "origin";
28
- /** Null means this image has not been analysed for a uniform light background. */
29
- isIsolated: boolean | null;
30
- };
31
- export type CandidateReadPaletteSwatch = {
32
- hex: string;
33
- proportion: number;
34
- name?: string | null;
35
- };
36
- export type CandidateReadCard = {
37
- variantId: VariantId;
38
- productId: string;
39
- brandSlug: string;
40
- materialBankId: string | null;
41
- brand: string;
42
- product: string;
43
- variantName: string | null;
44
- color: string | null;
45
- image: CandidateReadImage | null;
46
- palette: CandidateReadPaletteSwatch[];
47
- };
48
- export type CandidateRankEvidence = {
49
- rank: number;
50
- distance: number;
51
- similarity: number;
52
- basis: "active_main_image_embedding";
53
- provenanceGrade: "measured";
54
- displayImageMatchedEvidence: boolean | null;
55
- };
56
- export type CandidateReadCandidate = {
57
- evidence: CandidateRankEvidence;
58
- reason: string;
59
- } & CandidateReadCard;
60
- export type CandidateSeedEvidence = {
61
- evidenceImageSha256: string;
62
- displayImageSha256: string | null;
63
- basis: "active_main_image_embedding";
64
- provenanceGrade: "measured";
65
- displayImageMatchedEvidence: boolean | null;
66
- };
67
- export type CandidateReadReceipt = {
68
- operator: "looks_like";
69
- corpusScope: CorpusScopeReceipt | null;
70
- requestedLimit: number;
71
- returnedCount: number;
72
- exclusions: {
73
- requested: number;
74
- unique: number;
75
- applied: number;
76
- };
77
- dedupe: {
78
- retrieved: number;
79
- removed: number;
80
- /**
81
- * How many of `removed` went because an earlier row showed the SAME
82
- * PICTURE, counted apart from the id rules (MG-1917). Distinct products
83
- * routinely share one photograph, so an id-only collapse returned the same
84
- * image several times on one page.
85
- */
86
- removedBySharedImage: number;
87
- truncated: number;
88
- projectionMisses: number;
89
- };
90
- timing: {
91
- /** Internal seed projection completion; not a consumer response milestone. */
92
- seedProjectionMs: number;
93
- retrievalMs: number;
94
- projectionMs: number;
95
- completeMs: number;
96
- };
97
- };
98
- type CandidateReadResponseBase = {
99
- seed: CandidateReadCard;
100
- receipt: CandidateReadReceipt;
101
- };
102
- export type CandidateReadResponse = (CandidateReadResponseBase & {
103
- status: "ready";
104
- seedEvidence: CandidateSeedEvidence;
105
- candidates: CandidateReadCandidate[];
106
- reason: null;
107
- }) | (CandidateReadResponseBase & {
108
- status: "no_candidates" | "no_unseen_candidates" | "bounded_retrieval_unavailable";
109
- seedEvidence: CandidateSeedEvidence;
110
- candidates: [];
111
- reason: string;
112
- }) | (CandidateReadResponseBase & {
113
- status: "operator_unavailable";
114
- seedEvidence: null;
115
- candidates: [];
116
- reason: string;
117
- });
118
- export {};
@@ -1 +0,0 @@
1
- export {};