@instruments/materialgraph 0.25.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 (158) hide show
  1. package/association-types.d.ts +38 -27
  2. package/associations-client.d.ts +4 -4
  3. package/associations-client.js +3 -10
  4. package/attribution-types.d.ts +4 -4
  5. package/brand-types.d.ts +14 -6
  6. package/brands-client.d.ts +7 -38
  7. package/brands-client.js +10 -40
  8. package/by-colour-types.d.ts +58 -31
  9. package/by-spec-types.d.ts +6 -73
  10. package/by-spec-types.js +7 -5
  11. package/catalog-discovery-types.d.ts +11 -26
  12. package/catalogue-client.d.ts +16 -35
  13. package/catalogue-client.js +32 -67
  14. package/catalogue-types.d.ts +44 -4
  15. package/categories-client.d.ts +63 -0
  16. package/categories-client.js +48 -0
  17. package/category-types.d.ts +114 -0
  18. package/citation-types.d.ts +4 -4
  19. package/client-config.d.ts +4 -6
  20. package/client-config.js +2 -4
  21. package/client-source-material-comments.d.ts +4 -4
  22. package/client-source-material-comments.js +4 -38
  23. package/client-vocabulary.d.ts +7 -9
  24. package/client-vocabulary.js +22 -30
  25. package/client.d.ts +110 -244
  26. package/client.js +217 -387
  27. package/codes-client.d.ts +2 -2
  28. package/codes-client.js +8 -8
  29. package/codes-types.d.ts +55 -34
  30. package/colour-aggregate-types.d.ts +24 -24
  31. package/colours-client.d.ts +6 -11
  32. package/colours-client.js +11 -19
  33. package/coordinate-client.d.ts +2 -2
  34. package/coordinate-client.js +1 -13
  35. package/corpus-scope-types.d.ts +3 -3
  36. package/corpus-scope-types.js +1 -25
  37. package/demand-batch-types.d.ts +18 -18
  38. package/demand-types.d.ts +24 -24
  39. package/errors.d.ts +13 -13
  40. package/errors.js +54 -52
  41. package/http-transport.d.ts +13 -21
  42. package/http-transport.js +31 -28
  43. package/identify-types.d.ts +54 -44
  44. package/identify-types.js +5 -3
  45. package/index.d.ts +11 -27
  46. package/index.js +4 -6
  47. package/list-variant-facets-types.d.ts +60 -0
  48. package/list-variants-types.d.ts +142 -0
  49. package/list-variants-types.js +12 -0
  50. package/match-stream-types.d.ts +45 -32
  51. package/match-stream-types.js +2 -0
  52. package/match-stream.d.ts +2 -2
  53. package/match-stream.js +67 -49
  54. package/match-types.d.ts +32 -8
  55. package/material-asset-types.d.ts +89 -69
  56. package/material-block-types.d.ts +8 -6
  57. package/material-composition-client.d.ts +21 -0
  58. package/material-composition-client.js +13 -0
  59. package/material-composition-types.d.ts +403 -0
  60. package/material-query-plan-types.d.ts +61 -145
  61. package/material-resources-client.d.ts +12 -10
  62. package/material-resources-client.js +27 -22
  63. package/material-types.d.ts +16 -24
  64. package/ndjson.js +16 -8
  65. package/operations.d.ts +6 -6
  66. package/operations.js +29 -156
  67. package/package.json +5 -1
  68. package/palette-search-types.d.ts +87 -52
  69. package/query-understanding-types.d.ts +65 -40
  70. package/resolve-client.d.ts +8 -12
  71. package/resolve-client.js +9 -13
  72. package/resolve-colour-types.d.ts +8 -8
  73. package/resolve-types.d.ts +10 -10
  74. package/response-schemas.d.ts +20 -0
  75. package/response-schemas.generated.d.ts +5 -0
  76. package/response-schemas.generated.js +160 -0
  77. package/response-schemas.js +113 -0
  78. package/run-types.d.ts +64 -145
  79. package/runs.d.ts +9 -58
  80. package/runs.js +60 -149
  81. package/samplize-catalogue-types.d.ts +18 -18
  82. package/samplize-colorvec.d.ts +20 -20
  83. package/samplize-colorvec.js +66 -42
  84. package/schema-resource-types.d.ts +52 -39
  85. package/schema-resource-types.js +5 -5
  86. package/search-card-types.d.ts +26 -4
  87. package/search-index-plan-types.d.ts +70 -0
  88. package/search-refinement-types.d.ts +10 -40
  89. package/search-refinement-types.js +1 -0
  90. package/search-request-types.d.ts +121 -204
  91. package/search-response-receipt-types.d.ts +13 -253
  92. package/search-response-types.d.ts +2 -2
  93. package/search-result-validation.d.ts +3 -19
  94. package/search-result-validation.js +42 -183
  95. package/source-material-validation.d.ts +3 -3
  96. package/source-material-validation.js +35 -39
  97. package/spec-facet-types.d.ts +11 -16
  98. package/spec-types.d.ts +23 -16
  99. package/spec-types.js +8 -7
  100. package/specifications.d.ts +14 -72
  101. package/specifications.js +39 -89
  102. package/sse.d.ts +2 -2
  103. package/sse.js +32 -16
  104. package/substitute-types.d.ts +22 -22
  105. package/suggest-types.d.ts +11 -17
  106. package/suggest-types.js +3 -3
  107. package/taxonomy-coverage-types.d.ts +8 -8
  108. package/types.d.ts +202 -405
  109. package/validation.d.ts +26 -26
  110. package/validation.js +97 -92
  111. package/webmcp.d.ts +3 -3
  112. package/webmcp.generated.js +10 -93
  113. package/brand-most-sampled-types.d.ts +0 -33
  114. package/browse-types.d.ts +0 -236
  115. package/client-browse.d.ts +0 -78
  116. package/client-browse.js +0 -72
  117. package/client-exploration.d.ts +0 -9
  118. package/client-exploration.js +0 -7
  119. package/compare-types.d.ts +0 -89
  120. package/composition-client.d.ts +0 -33
  121. package/composition-client.js +0 -27
  122. package/composition-types.d.ts +0 -455
  123. package/composition-types.js +0 -10
  124. package/correction-types.d.ts +0 -88
  125. package/exploration-types.d.ts +0 -118
  126. package/exploration-types.js +0 -1
  127. package/fan-deck-types.d.ts +0 -42
  128. package/fan-deck-types.js +0 -9
  129. package/match-rejection-types.d.ts +0 -43
  130. package/match-rejection-types.js +0 -7
  131. package/palette-completion-types.d.ts +0 -115
  132. package/palette-completion-types.js +0 -1
  133. package/project-types.d.ts +0 -79
  134. package/project-types.js +0 -9
  135. package/projects.d.ts +0 -13
  136. package/projects.js +0 -46
  137. package/render-assets-types.d.ts +0 -65
  138. package/render-assets-types.js +0 -1
  139. package/run-events.d.ts +0 -106
  140. package/run-events.js +0 -32
  141. package/schedule-reference-types.d.ts +0 -46
  142. package/schedule-reference-types.js +0 -1
  143. package/schedule-references-client.d.ts +0 -14
  144. package/schedule-references-client.js +0 -26
  145. package/schedule-types.d.ts +0 -261
  146. package/schedule-types.js +0 -1
  147. package/search-collapse-types.d.ts +0 -69
  148. package/search-collapse-types.js +0 -1
  149. package/search-mood-types.d.ts +0 -6
  150. package/search-mood-types.js +0 -1
  151. package/search-window-types.d.ts +0 -25
  152. package/search-window-types.js +0 -1
  153. package/slot-pool-types.d.ts +0 -372
  154. package/slot-pool-types.js +0 -1
  155. /package/{brand-most-sampled-types.js → category-types.js} +0 -0
  156. /package/{browse-types.js → list-variant-facets-types.js} +0 -0
  157. /package/{compare-types.js → material-composition-types.js} +0 -0
  158. /package/{correction-types.js → search-index-plan-types.js} +0 -0
@@ -1,372 +0,0 @@
1
- /**
2
- * Hand-mirrored wire types for the slot-pool surface
3
- * (`POST /api/v1/schemes/pools`, operation `slot_pools`, MG-1301). Like the rest
4
- * of the SDK these interfaces carry NO runtime dependency on any
5
- * `@materialgraph/*` package — they mirror the `SlotPoolsRequest` /
6
- * `SlotPoolsResponse` shapes in `apps/web/public/openapi.yaml`.
7
- *
8
- * THE QUESTION IT ANSWERS: "for each of these slots, what should I be choosing
9
- * between?" One call, up to 24 slots, one ranked and gated pool each. There is
10
- * no project and no run — the request is self-contained and the ownership of the
11
- * work stays with you.
12
- *
13
- * THREE THINGS TO READ CORRECTLY, because getting them wrong turns a careful
14
- * answer into a false one:
15
- * 1. A pool with a `shortfall` of kind `search-failed` was NOT answered. The
16
- * other pools in the same response were. Never read that empty pool as
17
- * "nothing matched".
18
- * 2. `not_evaluated` and `missing` are not `failed`. The first means the engine
19
- * did not check the criterion at the tier that ran; the second means the
20
- * material holds no accepted value for it. Only `failed` means a value
21
- * exists and does not satisfy the ask.
22
- * 3. `eligible: false` does not mean "bad". It means this candidate cannot be
23
- * placed automatically — read `flags` for which of the reasons applies.
24
- *
25
- * TOLERANT-PARSING CONTRACT: response enums are widened with {@link OpenEnum}
26
- * so a new server value still type-checks; objects are read structurally.
27
- */
28
- import type { VerdictCitation } from "./citation-types.js";
29
- import type { VariantId } from "./identifiers.js";
30
- import type { OpenEnum } from "./types.js";
31
- /**
32
- * One requirement or preference. Request-side, so this is a STRICT union.
33
- * `attribute` asks for a canonical term, `attribute-presence` merely that the
34
- * attribute is recorded, `attribute-numeric` a one-sided bound. `unresolved`
35
- * carries brief language nothing bound to — it is never a filter and never
36
- * blamed for a coverage shortfall.
37
- */
38
- export type SlotPoolCriterion = {
39
- kind: "attribute";
40
- attributeId: string;
41
- term: string;
42
- raw: string;
43
- } | {
44
- kind: "attribute-presence";
45
- attributeId: string;
46
- raw: string;
47
- } | {
48
- kind: "attribute-numeric";
49
- attributeId: string;
50
- comparator: "at-least" | "at-most";
51
- value: number;
52
- unit?: string;
53
- raw: string;
54
- } | {
55
- kind: "unresolved";
56
- raw: string;
57
- suggestion?: {
58
- attributeId: string;
59
- term?: string;
60
- };
61
- coverageNote?: string;
62
- };
63
- /** A colour cue for a slot. Colours rerank within the retrieved set; they never admit. */
64
- export interface SlotPoolColourCue {
65
- /** `#rrggbb`. */
66
- hex: string;
67
- name?: string;
68
- }
69
- /**
70
- * What to do with a candidate the catalogue no longer lists. Neither value ever
71
- * marks such a candidate eligible — the policy decides only whether it is
72
- * returned at all.
73
- */
74
- export type SlotPoolAvailabilityPolicy = "flag-unavailable" | "exclude-unavailable";
75
- /** One slot of work. Self-contained: nothing in it identifies a project. */
76
- export interface SlotPoolTask {
77
- /**
78
- * YOUR key for this task, opaque to MaterialGraph and returned verbatim on the
79
- * matching pool. This is how you correlate 24 results; it is never parsed,
80
- * normalised or reused as a server id. Must be unique within a request.
81
- */
82
- taskKey: string;
83
- /**
84
- * The catalog category. OMITTING IT yields an empty pool with a `no-category`
85
- * shortfall — category is the only cross-kind gate, and retrieval will not
86
- * rank an ungated corpus.
87
- */
88
- category?: string;
89
- /** A short VISUAL description of the material wanted — not a keyword list. */
90
- intent?: string;
91
- required?: SlotPoolCriterion[];
92
- preferred?: SlotPoolCriterion[];
93
- colours?: SlotPoolColourCue[];
94
- /** Rank this task around an already-chosen variant. Ids are opaque tokens. */
95
- anchorSeed?: {
96
- variantId: VariantId;
97
- };
98
- exclude?: {
99
- variantIds?: VariantId[];
100
- brandSlugs?: string[];
101
- };
102
- availability?: SlotPoolAvailabilityPolicy;
103
- /** Candidates returned for this task. Max 48, default 12. */
104
- limit?: number;
105
- }
106
- /** Body for `POST /api/v1/schemes/pools` ({@link MaterialGraphClient.slotPools}). */
107
- export interface SlotPoolsRequest {
108
- /** Up to 24 tasks. Each is independent: one failing costs that one. */
109
- tasks: SlotPoolTask[];
110
- /**
111
- * Include the co-specification evidence among the returned candidates
112
- * (default true). One bounded read — never one request per candidate.
113
- */
114
- coSpecification?: boolean;
115
- }
116
- /** The six live verdict states, plus the two legacy tokens older rows carry. */
117
- export type SlotPoolVerdictState = OpenEnum<"matched" | "deviated" | "failed" | "unverified" | "missing" | "not_evaluated">;
118
- /** One cell of a candidate's report card against one criterion. */
119
- export interface SlotPoolVerdictCell {
120
- attributeId: string;
121
- state: SlotPoolVerdictState;
122
- strength: OpenEnum<"required" | "preferred">;
123
- baseline: {
124
- kind: "term";
125
- term: string;
126
- } | {
127
- kind: "presence";
128
- } | {
129
- kind: "seed";
130
- variantId: VariantId;
131
- } | {
132
- kind: "image";
133
- source: OpenEnum<"variant" | "vector">;
134
- variantId: VariantId | null;
135
- };
136
- /** The candidate's OWN accepted value, or null when it holds none. */
137
- value: string | null;
138
- deviation: {
139
- direction: OpenEnum<"above" | "below" | "other">;
140
- delta: number | null;
141
- unit: string | null;
142
- label: string;
143
- } | null;
144
- confidence: number | null;
145
- /**
146
- * WHERE the value came from — it ranks the SOURCE, not the accuracy. It says
147
- * nothing about whether the value is right.
148
- */
149
- sourceBasis: string | null;
150
- trustGap: OpenEnum<"below_confidence" | "basis_unmet" | "proposed"> | null;
151
- citation?: VerdictCitation;
152
- }
153
- /** Why a candidate is labelled. An eligible candidate carries none of these. */
154
- export type SlotPoolFlag = OpenEnum<"below-floor" | "required-not-applied" | "discontinued" | "superseded" | "unverified-value">;
155
- export type SlotPoolAvailability = OpenEnum<"available" | "discontinued" | "superseded" | "unknown">;
156
- /** The declared successor of a withdrawn material, one hop only. */
157
- export interface SlotPoolSuccessor {
158
- variantId: VariantId;
159
- brandSlug: string;
160
- productId: string;
161
- brand: string;
162
- product: string;
163
- variant: string;
164
- color: string | null;
165
- availability: SlotPoolAvailability;
166
- }
167
- /**
168
- * The features a composer scores on. Colours are EXTRACTED FROM PRODUCT IMAGERY
169
- * — visual likeness, never a declared colour specification. An empty `palette`
170
- * or `attributes` means nothing is on record, never that the material has none.
171
- */
172
- export interface SlotPoolCandidateFeatures {
173
- colour: {
174
- dominantHex: string | null;
175
- hsl: {
176
- h: number;
177
- s: number;
178
- l: number;
179
- } | null;
180
- oklab: {
181
- l: number;
182
- a: number;
183
- b: number;
184
- } | null;
185
- chroma: number | null;
186
- vibrancy: number | null;
187
- sourceBasis?: string;
188
- };
189
- palette: {
190
- hex: string;
191
- proportion: number;
192
- name?: string | null;
193
- oklab?: {
194
- l: number;
195
- a: number;
196
- b: number;
197
- };
198
- }[];
199
- attributes: {
200
- attributeId: string;
201
- term: string;
202
- }[];
203
- dimensions: Record<string, unknown>[] | null;
204
- }
205
- export interface SlotPoolCandidate {
206
- variantId: VariantId;
207
- productId: string;
208
- brandSlug: string;
209
- brand: string;
210
- product: string;
211
- variant: string;
212
- category: string | null;
213
- materialBankId: string | null;
214
- imageUrl: string | null;
215
- availability: SlotPoolAvailability;
216
- supersededBy: SlotPoolSuccessor | null;
217
- /**
218
- * True only when every required criterion was applied, the catalogue still
219
- * lists the material, and no exclusion touched it. Anything else needs a
220
- * human decision — read `flags` for which reason.
221
- */
222
- eligible: boolean;
223
- flags: SlotPoolFlag[];
224
- score: {
225
- /** Normalised to [0,1] against the best score on THIS pool's page. */
226
- retrieval: number;
227
- /** `unverified` + `not_evaluated` cells. A soft penalty, not a failure count. */
228
- unknownCount: number;
229
- verdictCounts: {
230
- matched: number;
231
- deviated: number;
232
- failed: number;
233
- unverified: number;
234
- missing: number;
235
- notEvaluated: number;
236
- };
237
- };
238
- verdict: {
239
- cells: SlotPoolVerdictCell[];
240
- grade: OpenEnum<"meets_all" | "close" | "hard_no">;
241
- minConfidence: number | null;
242
- };
243
- features: SlotPoolCandidateFeatures;
244
- }
245
- /**
246
- * Why a pool is short. Four different facts, and none of them is "nothing in
247
- * the catalogue matches your brief".
248
- */
249
- export type SlotPoolShortfall = {
250
- kind: "no-category";
251
- } | {
252
- kind: "category-coverage";
253
- category: string;
254
- attributeIds: string[];
255
- gaps?: ({
256
- level: "attribute";
257
- attributeId: string;
258
- } | {
259
- level: "value";
260
- attributeId: string;
261
- term: string;
262
- })[];
263
- } | {
264
- kind: "search-failed";
265
- detail: string;
266
- } | {
267
- kind: "no-match";
268
- tier: string;
269
- consideredCount: number;
270
- };
271
- export interface SlotPool {
272
- /** Your own key, verbatim. */
273
- taskKey: string;
274
- category: string | null;
275
- /** The relaxation rung the returned candidates were drawn at. */
276
- retrievalTier: OpenEnum<"strict" | "presence" | "category-only">;
277
- /**
278
- * HOW the candidates were retrieved. DERIVED from the retrieval plan and the
279
- * pool's receipt — MaterialGraph does not report an arm per candidate.
280
- *
281
- * It is constant across the relaxation rungs, so it cannot tell you how far
282
- * the ladder went. `retrievalTier` beside it names the rung the pool settled
283
- * on: the arm says how, the tier says how strictly.
284
- */
285
- arm: OpenEnum<"visual-text" | "image-similarity" | "none">;
286
- candidates: SlotPoolCandidate[];
287
- /** How much retrieval scored before this task's own `limit` trimmed the page. */
288
- consideredCount: number;
289
- returnedCount: number;
290
- excludedCount: number;
291
- unavailableDroppedCount: number;
292
- /**
293
- * The criteria nothing on this page could be graded on — a statement about
294
- * catalogue COVERAGE, never about the candidates.
295
- */
296
- unknownCoverage: {
297
- evaluatedCriteria: number;
298
- /** Every returned candidate graded `not_evaluated` on these. */
299
- uncheckedCriteria: string[];
300
- /** Every returned candidate graded `missing` on these. */
301
- unheldCriteria: string[];
302
- };
303
- shortfall: SlotPoolShortfall | null;
304
- seededFrom: {
305
- variantId: VariantId;
306
- } | null;
307
- warnings: string[];
308
- }
309
- /**
310
- * The sparse pairing graph among the returned candidates. Each unordered pair
311
- * appears ONCE and the relation is symmetric. An empty `edges` under a null
312
- * `datasetSessionId` means the dataset is absent, NOT that these materials are
313
- * never specified together.
314
- */
315
- export interface SlotPoolCoSpecification {
316
- edges: {
317
- from: VariantId;
318
- to: VariantId;
319
- projectCount: number;
320
- }[];
321
- coverage: {
322
- candidateCount: number;
323
- coveredCount: number;
324
- truncated: boolean;
325
- datasetSessionId: string | null;
326
- window: string;
327
- signal: string;
328
- };
329
- }
330
- /** The `200` body from `POST /api/v1/schemes/pools`. */
331
- export interface SlotPoolsResponse {
332
- versions: {
333
- contract: string;
334
- retrieval: string;
335
- evaluator: string;
336
- dataset: {
337
- coSpecificationSessionId: string | null;
338
- };
339
- };
340
- /** One pool per task, in request order. Correlate by `taskKey`, not by index. */
341
- pools: SlotPool[];
342
- coSpecification: SlotPoolCoSpecification | null;
343
- summary: {
344
- tasks: number;
345
- eligibleCandidates: number;
346
- flaggedCandidates: number;
347
- tasksWithEligibleCandidates: number;
348
- tasksWithoutEligibleCandidates: number;
349
- /** Non-zero means some tasks were NOT answered; their pools say so. */
350
- searchFailed: number;
351
- noCategory: number;
352
- categoryCoverage: number;
353
- noMatch: number;
354
- };
355
- /**
356
- * CALL VOLUME — how many of each bounded operation the request performed.
357
- *
358
- * Never a cost or token figure. Slot retrieval is database and embedding work
359
- * and does not go through the model-call path that carries token and spend
360
- * accounting, so no such figure exists for it. Do not render these as usage
361
- * or spend.
362
- */
363
- calls: {
364
- searchesRun: number;
365
- searchesFailed: number;
366
- candidatesConsidered: number;
367
- candidatesReturned: number;
368
- hydrationBatches: number;
369
- coSpecificationQueries: number;
370
- };
371
- warnings: string[];
372
- }
@@ -1 +0,0 @@
1
- export {};