@instruments/materialgraph 0.23.0 → 0.25.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.
@@ -5,6 +5,7 @@ import type { CreateCorrectionInput, CorrectionResponse, CorrectionsListResponse
5
5
  import type { HttpTransport } from "./http-transport.js";
6
6
  import type { VariantId } from "./identifiers.js";
7
7
  import type { IdentifySelectedPageInput, IdentifySelectedPageResult } from "./identify-types.js";
8
+ import type { MatchRejection, MatchRejectionList, RejectMatchResultInput } from "./match-rejection-types.js";
8
9
  import type { SamplizeCatalogueOptions, SamplizeCataloguePage } from "./samplize-catalogue-types.js";
9
10
  import type { SamplizeColorVecCache } from "./samplize-colorvec.js";
10
11
  /** Catalogue publication operations inherited by the public SDK client. */
@@ -27,6 +28,16 @@ export declare class CatalogueClient {
27
28
  cursor?: string;
28
29
  limit?: number;
29
30
  }, signal?: AbortSignal): Promise<CorrectionsListResponse>;
31
+ /**
32
+ * Record "not this" on one result a match showed, against the response it
33
+ * came from. `responseId` is that response's `attribution.responseId`; the
34
+ * call needs the same key the match was made with. Repeating a rejection
35
+ * returns the original receipt. This judges the match ranking and is never a
36
+ * catalogue correction - wrong product facts go through `createCorrection`.
37
+ */
38
+ rejectMatchResult(responseId: string, input: RejectMatchResultInput, signal?: AbortSignal): Promise<MatchRejection>;
39
+ /** Read one match response back with every rejection recorded against it. */
40
+ matchRejections(responseId: string, signal?: AbortSignal): Promise<MatchRejectionList>;
30
41
  /** Identify the canonical graph subject for one explicitly selected page. */
31
42
  identify(input: IdentifySelectedPageInput, signal?: AbortSignal): Promise<IdentifySelectedPageResult>;
32
43
  /** Complete producer-owned vectors and classifications for portable colour matching. */
@@ -37,6 +37,20 @@ export class CatalogueClient {
37
37
  signal,
38
38
  });
39
39
  }
40
+ /**
41
+ * Record "not this" on one result a match showed, against the response it
42
+ * came from. `responseId` is that response's `attribution.responseId`; the
43
+ * call needs the same key the match was made with. Repeating a rejection
44
+ * returns the original receipt. This judges the match ranking and is never a
45
+ * catalogue correction - wrong product facts go through `createCorrection`.
46
+ */
47
+ rejectMatchResult(responseId, input, signal) {
48
+ return this.#transport.requestJson(resolveOperation("reject_match_result"), { pathParams: { responseId }, body: input, signal });
49
+ }
50
+ /** Read one match response back with every rejection recorded against it. */
51
+ matchRejections(responseId, signal) {
52
+ return this.#transport.requestJson(resolveOperation("list_match_rejections"), { pathParams: { responseId }, signal });
53
+ }
40
54
  /** Identify the canonical graph subject for one explicitly selected page. */
41
55
  identify(input, signal) {
42
56
  return this.#transport.requestJson(resolveOperation("retrieval.identify"), { body: input, signal });
@@ -77,6 +77,13 @@ export interface CandidateReadReceipt {
77
77
  dedupe: {
78
78
  retrieved: number;
79
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;
80
87
  truncated: number;
81
88
  projectionMisses: number;
82
89
  };
package/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export type * from "./substitute-types.js";
50
50
  export type * from "./search-refinement-types.js";
51
51
  export type * from "./search-window-types.js";
52
52
  export type * from "./attribution-types.js";
53
+ export type * from "./match-rejection-types.js";
53
54
  export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
54
55
  export type * from "./spec-types.js";
55
56
  export { certificationProgramme, certificationProgrammeCriterion, hasSpec, specCriterion, specRangeCriterion, specTerm, } from "./specifications.js";
@@ -0,0 +1,43 @@
1
+ /**
2
+ * "Not this" on a photo match result (MG-1859). A rejection is feedback on the
3
+ * match ranking, recorded against the response that showed the result. It is
4
+ * never a catalogue correction; wrong facts about a product go through
5
+ * `createCorrection`.
6
+ */
7
+ export interface RejectMatchResultInput {
8
+ /**
9
+ * The surface the result was shown under - `surfaces[].surface.id` on a scene
10
+ * match. Omit it for a result from the run-level `results` list.
11
+ */
12
+ surfaceId?: string;
13
+ /** The rejected result's `variantId`, verbatim. */
14
+ variantId: string;
15
+ /** Optional free text, up to 500 characters. Stored as given. */
16
+ reason?: string;
17
+ }
18
+ /** The receipt for one rejection. A repeat of the same rejection returns the original. */
19
+ export interface MatchRejection {
20
+ rejectionId: string;
21
+ /** The match response's `attribution.responseId`. */
22
+ responseId: string;
23
+ /** Null when the result came from the run-level list. */
24
+ surfaceId: string | null;
25
+ variantId: string;
26
+ /** The 1-based position the match response showed this result at, within its surface. */
27
+ rank: number;
28
+ reason: string | null;
29
+ /** ISO-8601. */
30
+ rejectedAt: string;
31
+ }
32
+ /** One match response and every rejection recorded against it. */
33
+ export interface MatchRejectionList {
34
+ responseId: string;
35
+ /** `stream` for a scene match, `buffered` for the single-image JSON response. */
36
+ lane: "buffered" | "stream";
37
+ /** ISO-8601 time the match response was issued. */
38
+ issuedAt: string;
39
+ /** Ranked results the response showed, across every surface - a rejection rate's denominator. */
40
+ resultCount: number;
41
+ /** Oldest first. Empty means nothing was rejected. */
42
+ rejections: MatchRejection[];
43
+ }
@@ -0,0 +1,7 @@
1
+ /**
2
+ * "Not this" on a photo match result (MG-1859). A rejection is feedback on the
3
+ * match ranking, recorded against the response that showed the result. It is
4
+ * never a catalogue correction; wrong facts about a product go through
5
+ * `createCorrection`.
6
+ */
7
+ export {};
@@ -78,6 +78,19 @@ export interface MaterialTile {
78
78
  */
79
79
  colourName?: string;
80
80
  }
81
+ /**
82
+ * A sibling card: the tile, plus — when another variant of the same product
83
+ * shares both its `variantName` and its `colourName` — the one attribute that
84
+ * tells them apart (MG-1857: IndoTeak's Reclaimed Teak is ten "Unfinished"
85
+ * variants that differ only by product code). Declared size first, then product
86
+ * code. The two fields arrive together or not at all; absent means nothing
87
+ * collides, or neither attribute separates every look-alike.
88
+ */
89
+ export interface SiblingTile extends MaterialTile {
90
+ distinguishedBy?: OpenEnum<"size" | "code">;
91
+ /** This sibling's value of `distinguishedBy`, e.g. `"3.5 in"`. */
92
+ distinction?: string;
93
+ }
81
94
  /**
82
95
  * A canonical attribute/term pair carried on a detail record.
83
96
  *
package/operations.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export declare const MATERIALGRAPH_API_VERSION = "0.7.0";
2
- declare const OPERATION_DEFINITIONS: readonly [readonly ["brandMostSampled", "GET", "/api/v1/brands/most-sampled", "brands.most_sampled"], readonly ["colours.complete", "POST", "/api/v1/colours/palettes/complete", "complete_interior_palette"], readonly ["colours.discover", "GET", "/api/v1/colours/palettes", "discover_interior_palettes"], readonly ["samplizeColorVecCache", "GET", "/api/v1/catalogues/samplize/colorvec", "samplize_colorvec_cache"], readonly ["samplizeCatalogueSearch", "POST", "/api/v1/catalogues/samplize/search", "samplize_catalogue_search"], readonly ["scheduleReferences.list", "GET", "/api/v1/schedules/{scheduleId}/references", "list_schedule_reference_feedback"], readonly ["scheduleReferences.put", "PUT", "/api/v1/schedules/{scheduleId}/references/{referenceId}", "put_schedule_reference_feedback"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["search", "POST", "/api/v1/search", "search_materials_post"], readonly ["identify", "POST", "/api/v1/identify", "retrieval.identify"], readonly ["compare", "POST", "/api/v1/compare", "retrieval.compare"], readonly ["createCorrection", "POST", "/api/v1/corrections", "corrections.create"], readonly ["getCorrection", "GET", "/api/v1/corrections/{correctionId}", "corrections.get"], readonly ["listCorrections", "GET", "/api/v1/corrections", "corrections.list"], readonly ["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"], readonly ["samplizeCatalogue", "GET", "/api/v1/catalogues/samplize/products", "samplize_catalogue_products"], readonly ["searchGet", "GET", "/api/v1/search", "search_materials_get"], readonly ["match", "POST", "/api/v1/search/match", "match_material"], readonly ["byColour", "GET", "/api/v1/search/colours", "search_by_colour"], readonly ["material", "GET", "/api/v1/materials/{variantId}", "get_material"], readonly ["catalogueReferences", "POST", "/api/v1/catalogues/references", "get_catalogue_references_batch"], readonly ["catalogueCollections", "GET", "/api/v1/catalogues/collections", "list_catalogue_channel_collections"], readonly ["catalogueDocumentAccess", "GET", "/api/v1/catalogues/documents/{documentId}", "get_catalogue_document_access"], readonly ["siblings", "GET", "/api/v1/materials/{variantId}/siblings", "get_material_siblings"], readonly ["materialBlocks", "GET", "/api/v1/materials/{variantId}/blocks", "list_material_blocks"], readonly ["materialAssets", "GET", "/api/v1/materials/{variantId}/assets", "list_material_assets"], readonly ["materialRenderAssets", "GET", "/api/v1/materials/{variantId}/render-assets", "get_material_render_assets"], readonly ["materialDocuments", "GET", "/api/v1/materials/{variantId}/documents", "list_material_documents"], readonly ["exploration.operators", "GET", "/api/v1/materials/{variantId}/operators", "list_material_operators"], readonly ["exploration.candidates", "POST", "/api/v1/materials/{variantId}/candidates", "read_material_candidates"], readonly ["schema", "GET", "/api/v1/schema/blocks", "list_schema_blocks"], readonly ["schema", "GET", "/api/v1/schema/attributes", "list_schema_attributes"], readonly ["schema", "GET", "/api/v1/schema/verticals", "list_schema_verticals"], readonly ["schema", "GET", "/api/v1/schema/product-types", "list_schema_product_types"], readonly ["schema", "GET", "/api/v1/schema/units", "list_schema_units"], readonly ["schema", "GET", "/api/v1/schema/value-dictionaries", "list_schema_value_dictionaries"], readonly ["schema", "GET", "/api/v1/schema/source-requirements", "list_schema_source_requirements"], readonly ["schema", "GET", "/api/v1/schema/product-type-templates", "list_schema_product_type_templates"], readonly ["schema", "GET", "/api/v1/schema/mappings", "list_schema_mappings"], readonly ["pairings", "GET", "/api/v1/materials/{variantId}/pairings", "get_material_pairings"], readonly ["findSubstitutes", "POST", "/api/v1/materials/{variantId}/substitutes", "find_material_substitutes"], readonly ["associatedFinishes", "GET", "/api/v1/associated/finishes", "list_associated_finishes"], readonly ["associatedProducts", "GET", "/api/v1/associated/products", "list_associated_products"], readonly ["applicability", "GET", "/api/v1/applicability", "get_applicability"], readonly ["materials", "POST", "/api/v1/materials/batch", "get_materials_batch_post"], readonly ["materialsCached", "GET", "/api/v1/materials/batch", "get_materials_batch_get"], readonly ["browse", "GET", "/api/v1/search/browse", "search_browse_by_colour"], readonly ["colourFacets", "GET", "/api/v1/colours/facets", "get_colour_facets"], readonly ["colours.profiles", "GET", "/api/v1/colours/profiles", "get_category_colour_profiles"], readonly ["colours.stats", "GET", "/api/v1/colours/stats", "get_colour_stats"], readonly ["resolveColour", "GET", "/api/v1/search/colours/resolve", "resolve_colour_name"], readonly ["suggestColour", "GET", "/api/v1/search/colours/suggest", "suggest_colour_names"], readonly ["suggest", "GET", "/api/v1/search/suggest", "search_suggest"], readonly ["resolveAttribute", "GET", "/api/v1/catalog/attributes/resolve", "catalog_resolve_attribute"], readonly ["resolveAttributeValue", "GET", "/api/v1/catalog/attributes/{attributeId}/values/resolve", "catalog_resolve_value"], readonly ["searchVocabulary", "GET", "/api/v1/catalog/vocabulary/search", "catalog_vocabulary_search"], readonly ["resolve", "POST", "/api/v1/resolve", "resolve_phrases"], readonly ["bySpec", "GET", "/api/v1/search/specifications", "catalog_by_spec"], readonly ["taxonomy", "GET", "/api/v1/taxonomy/categories", "get_category_taxonomy"], readonly ["productTypeCoverage", "GET", "/api/v1/taxonomy/coverage", "get_product_type_status_coverage"], readonly ["whoami", "GET", "/api/v1/whoami", "whoami"], readonly ["coordinate", "POST", "/api/v1/pairings/coordinate", "coordinate_materials"], readonly ["demand", "GET", "/api/v1/demand", "get_material_demand"], readonly ["colours.palette", "POST", "/api/v1/search/palettes", "search_by_palette"], readonly ["extractPalette", "POST", "/api/v1/search/palettes/extract", "extract_image_palette"], readonly ["colours.gradient", "POST", "/api/v1/search/gradients", "search_by_gradient"], readonly ["specificationFacets", "GET", "/api/v1/catalog/specifications/facets", "list_spec_facets"], readonly ["attributeValues", "GET", "/api/v1/catalog/attributes/{attributeId}/values", "list_attribute_values"], readonly ["applicableSpecs", "GET", "/api/v1/taxonomy/categories/{key}/specs", "get_applicable_specs"], readonly ["glossary", "GET", "/api/v1/glossary/{term}", "explain_material_term"], readonly ["brands", "GET", "/api/v1/brands", "list_brands"], readonly ["brand", "GET", "/api/v1/brands/{brandSlug}", "get_brand_profile"], readonly ["brandColourDeck", "GET", "/api/v1/brands/{brandSlug}/colours", "brand_colour_deck"], readonly ["uploadSourceMaterial", "POST", "/api/v1/source-material", "upload_source_material"], readonly ["sourceMaterialBatch", "GET", "/api/v1/source-material/{batchId}", "get_source_material_batch"], readonly ["sourceMaterialComments.list", "GET", "/api/v1/source-material/{batchId}/sources/{sourceId}/comments", "list_source_material_comments"], readonly ["sourceMaterialComments.post", "POST", "/api/v1/source-material/{batchId}/sources/{sourceId}/comments", "post_source_material_comment"], readonly ["capabilities", "GET", "/api/v1/capabilities", "list_public_capabilities"], readonly ["createRun", "POST", "/api/v1/runs", "create_public_run"], readonly ["listRuns", "GET", "/api/v1/runs", "list_public_runs"], readonly ["run", "GET", "/api/v1/runs/{runId}", "get_public_run"], readonly ["runSchedule", "GET", "/api/v1/runs/{runId}/schedule", "get_run_finish_schedule"], readonly ["citation", "GET", "/api/v1/citations/{citationId}", "get_verdict_citation"], readonly ["streamRunEvents", "GET", "/api/v1/runs/{runId}/events", "list_public_run_events"], readonly ["resumeRun", "POST", "/api/v1/runs/{runId}/resume", "resume_public_run"], readonly ["cancelRun", "POST", "/api/v1/runs/{runId}/cancel", "cancel_public_run"], readonly ["varyScheme", "POST", "/api/v1/schemes/vary", "vary_schemes"], readonly ["slotPools", "POST", "/api/v1/schemes/pools", "slot_pools"], readonly ["createProject", "POST", "/api/v1/projects", "create_box_project"], readonly ["listProjects", "GET", "/api/v1/projects", "list_box_projects"], readonly ["getProject", "GET", "/api/v1/projects/{projectId}", "get_box_project"], readonly ["appendProjectEvent", "POST", "/api/v1/projects/{projectId}/events", "append_box_project_event"], readonly ["demandBatch", "POST", "/api/v1/demand/batch", "get_demand_batch"], readonly ["codeAdvisory", "POST", "/api/v1/codes/advisory", "resolveCodeAdvisory"], readonly ["codes.context", "GET", "/api/v1/codes/context", "list_code_context"], readonly ["codes.requirements", "GET", "/api/v1/codes/requirements", "list_code_requirements"]];
2
+ declare const OPERATION_DEFINITIONS: readonly [readonly ["brandMostSampled", "GET", "/api/v1/brands/most-sampled", "brands.most_sampled"], readonly ["colours.complete", "POST", "/api/v1/colours/palettes/complete", "complete_interior_palette"], readonly ["colours.discover", "GET", "/api/v1/colours/palettes", "discover_interior_palettes"], readonly ["samplizeColorVecCache", "GET", "/api/v1/catalogues/samplize/colorvec", "samplize_colorvec_cache"], readonly ["samplizeCatalogueSearch", "POST", "/api/v1/catalogues/samplize/search", "samplize_catalogue_search"], readonly ["scheduleReferences.list", "GET", "/api/v1/schedules/{scheduleId}/references", "list_schedule_reference_feedback"], readonly ["scheduleReferences.put", "PUT", "/api/v1/schedules/{scheduleId}/references/{referenceId}", "put_schedule_reference_feedback"], readonly ["catalogs", "GET", "/api/v1/catalogs", "list_catalog_documents"], readonly ["catalogPages", "GET", "/api/v1/catalogs/{catalogId}/pages", "list_catalog_pages"], readonly ["catalogPageRepresentation", "GET", "/api/v1/catalog-pages/{pageId}/representation", "get_catalog_page_representation"], readonly ["catalogReferences", "GET", "/api/v1/catalogs/{catalogId}/references", "list_catalog_product_references"], readonly ["search", "POST", "/api/v1/search", "search_materials_post"], readonly ["identify", "POST", "/api/v1/identify", "retrieval.identify"], readonly ["compare", "POST", "/api/v1/compare", "retrieval.compare"], readonly ["createCorrection", "POST", "/api/v1/corrections", "corrections.create"], readonly ["getCorrection", "GET", "/api/v1/corrections/{correctionId}", "corrections.get"], readonly ["listCorrections", "GET", "/api/v1/corrections", "corrections.list"], readonly ["planQuery", "POST", "/api/v1/search/plan", "plan_material_query"], readonly ["samplizeCatalogue", "GET", "/api/v1/catalogues/samplize/products", "samplize_catalogue_products"], readonly ["searchGet", "GET", "/api/v1/search", "search_materials_get"], readonly ["match", "POST", "/api/v1/search/match", "match_material"], readonly ["rejectMatchResult", "POST", "/api/v1/search/match/{responseId}/rejections", "reject_match_result"], readonly ["matchRejections", "GET", "/api/v1/search/match/{responseId}/rejections", "list_match_rejections"], readonly ["byColour", "GET", "/api/v1/search/colours", "search_by_colour"], readonly ["material", "GET", "/api/v1/materials/{variantId}", "get_material"], readonly ["catalogueReferences", "POST", "/api/v1/catalogues/references", "get_catalogue_references_batch"], readonly ["catalogueCollections", "GET", "/api/v1/catalogues/collections", "list_catalogue_channel_collections"], readonly ["catalogueDocumentAccess", "GET", "/api/v1/catalogues/documents/{documentId}", "get_catalogue_document_access"], readonly ["siblings", "GET", "/api/v1/materials/{variantId}/siblings", "get_material_siblings"], readonly ["materialBlocks", "GET", "/api/v1/materials/{variantId}/blocks", "list_material_blocks"], readonly ["materialAssets", "GET", "/api/v1/materials/{variantId}/assets", "list_material_assets"], readonly ["materialRenderAssets", "GET", "/api/v1/materials/{variantId}/render-assets", "get_material_render_assets"], readonly ["materialDocuments", "GET", "/api/v1/materials/{variantId}/documents", "list_material_documents"], readonly ["exploration.operators", "GET", "/api/v1/materials/{variantId}/operators", "list_material_operators"], readonly ["exploration.candidates", "POST", "/api/v1/materials/{variantId}/candidates", "read_material_candidates"], readonly ["schema", "GET", "/api/v1/schema/blocks", "list_schema_blocks"], readonly ["schema", "GET", "/api/v1/schema/attributes", "list_schema_attributes"], readonly ["schema", "GET", "/api/v1/schema/verticals", "list_schema_verticals"], readonly ["schema", "GET", "/api/v1/schema/product-types", "list_schema_product_types"], readonly ["schema", "GET", "/api/v1/schema/units", "list_schema_units"], readonly ["schema", "GET", "/api/v1/schema/value-dictionaries", "list_schema_value_dictionaries"], readonly ["schema", "GET", "/api/v1/schema/source-requirements", "list_schema_source_requirements"], readonly ["schema", "GET", "/api/v1/schema/product-type-templates", "list_schema_product_type_templates"], readonly ["schema", "GET", "/api/v1/schema/mappings", "list_schema_mappings"], readonly ["pairings", "GET", "/api/v1/materials/{variantId}/pairings", "get_material_pairings"], readonly ["findSubstitutes", "POST", "/api/v1/materials/{variantId}/substitutes", "find_material_substitutes"], readonly ["associatedFinishes", "GET", "/api/v1/associated/finishes", "list_associated_finishes"], readonly ["associatedProducts", "GET", "/api/v1/associated/products", "list_associated_products"], readonly ["applicability", "GET", "/api/v1/applicability", "get_applicability"], readonly ["materials", "POST", "/api/v1/materials/batch", "get_materials_batch_post"], readonly ["materialsCached", "GET", "/api/v1/materials/batch", "get_materials_batch_get"], readonly ["browse", "GET", "/api/v1/search/browse", "search_browse_by_colour"], readonly ["colourFacets", "GET", "/api/v1/colours/facets", "get_colour_facets"], readonly ["colours.profiles", "GET", "/api/v1/colours/profiles", "get_category_colour_profiles"], readonly ["colours.stats", "GET", "/api/v1/colours/stats", "get_colour_stats"], readonly ["resolveColour", "GET", "/api/v1/search/colours/resolve", "resolve_colour_name"], readonly ["suggestColour", "GET", "/api/v1/search/colours/suggest", "suggest_colour_names"], readonly ["suggest", "GET", "/api/v1/search/suggest", "search_suggest"], readonly ["resolveAttribute", "GET", "/api/v1/catalog/attributes/resolve", "catalog_resolve_attribute"], readonly ["resolveAttributeValue", "GET", "/api/v1/catalog/attributes/{attributeId}/values/resolve", "catalog_resolve_value"], readonly ["searchVocabulary", "GET", "/api/v1/catalog/vocabulary/search", "catalog_vocabulary_search"], readonly ["resolve", "POST", "/api/v1/resolve", "resolve_phrases"], readonly ["bySpec", "GET", "/api/v1/search/specifications", "catalog_by_spec"], readonly ["taxonomy", "GET", "/api/v1/taxonomy/categories", "get_category_taxonomy"], readonly ["productTypeCoverage", "GET", "/api/v1/taxonomy/coverage", "get_product_type_status_coverage"], readonly ["whoami", "GET", "/api/v1/whoami", "whoami"], readonly ["coordinate", "POST", "/api/v1/pairings/coordinate", "coordinate_materials"], readonly ["demand", "GET", "/api/v1/demand", "get_material_demand"], readonly ["colours.palette", "POST", "/api/v1/search/palettes", "search_by_palette"], readonly ["extractPalette", "POST", "/api/v1/search/palettes/extract", "extract_image_palette"], readonly ["colours.gradient", "POST", "/api/v1/search/gradients", "search_by_gradient"], readonly ["specificationFacets", "GET", "/api/v1/catalog/specifications/facets", "list_spec_facets"], readonly ["attributeValues", "GET", "/api/v1/catalog/attributes/{attributeId}/values", "list_attribute_values"], readonly ["applicableSpecs", "GET", "/api/v1/taxonomy/categories/{key}/specs", "get_applicable_specs"], readonly ["glossary", "GET", "/api/v1/glossary/{term}", "explain_material_term"], readonly ["brands", "GET", "/api/v1/brands", "list_brands"], readonly ["brand", "GET", "/api/v1/brands/{brandSlug}", "get_brand_profile"], readonly ["brandColourDeck", "GET", "/api/v1/brands/{brandSlug}/colours", "brand_colour_deck"], readonly ["uploadSourceMaterial", "POST", "/api/v1/source-material", "upload_source_material"], readonly ["sourceMaterialBatch", "GET", "/api/v1/source-material/{batchId}", "get_source_material_batch"], readonly ["sourceMaterialComments.list", "GET", "/api/v1/source-material/{batchId}/sources/{sourceId}/comments", "list_source_material_comments"], readonly ["sourceMaterialComments.post", "POST", "/api/v1/source-material/{batchId}/sources/{sourceId}/comments", "post_source_material_comment"], readonly ["capabilities", "GET", "/api/v1/capabilities", "list_public_capabilities"], readonly ["createRun", "POST", "/api/v1/runs", "create_public_run"], readonly ["listRuns", "GET", "/api/v1/runs", "list_public_runs"], readonly ["run", "GET", "/api/v1/runs/{runId}", "get_public_run"], readonly ["runSchedule", "GET", "/api/v1/runs/{runId}/schedule", "get_run_finish_schedule"], readonly ["citation", "GET", "/api/v1/citations/{citationId}", "get_verdict_citation"], readonly ["streamRunEvents", "GET", "/api/v1/runs/{runId}/events", "list_public_run_events"], readonly ["resumeRun", "POST", "/api/v1/runs/{runId}/resume", "resume_public_run"], readonly ["cancelRun", "POST", "/api/v1/runs/{runId}/cancel", "cancel_public_run"], readonly ["varyScheme", "POST", "/api/v1/schemes/vary", "vary_schemes"], readonly ["slotPools", "POST", "/api/v1/schemes/pools", "slot_pools"], readonly ["createProject", "POST", "/api/v1/projects", "create_box_project"], readonly ["listProjects", "GET", "/api/v1/projects", "list_box_projects"], readonly ["getProject", "GET", "/api/v1/projects/{projectId}", "get_box_project"], readonly ["appendProjectEvent", "POST", "/api/v1/projects/{projectId}/events", "append_box_project_event"], readonly ["demandBatch", "POST", "/api/v1/demand/batch", "get_demand_batch"], readonly ["codeAdvisory", "POST", "/api/v1/codes/advisory", "resolveCodeAdvisory"], readonly ["codes.context", "GET", "/api/v1/codes/context", "list_code_context"], readonly ["codes.requirements", "GET", "/api/v1/codes/requirements", "list_code_requirements"]];
3
3
  export type SdkOperationId = (typeof OPERATION_DEFINITIONS)[number][3];
4
4
  export type SdkOperation = Readonly<{
5
5
  clientMethod: (typeof OPERATION_DEFINITIONS)[number][0];
package/operations.js CHANGED
@@ -82,6 +82,18 @@ const OPERATION_DEFINITIONS = [
82
82
  ],
83
83
  ["searchGet", "GET", "/api/v1/search", "search_materials_get"],
84
84
  ["match", "POST", "/api/v1/search/match", "match_material"],
85
+ [
86
+ "rejectMatchResult",
87
+ "POST",
88
+ "/api/v1/search/match/{responseId}/rejections",
89
+ "reject_match_result",
90
+ ],
91
+ [
92
+ "matchRejections",
93
+ "GET",
94
+ "/api/v1/search/match/{responseId}/rejections",
95
+ "list_match_rejections",
96
+ ],
85
97
  ["byColour", "GET", "/api/v1/search/colours", "search_by_colour"],
86
98
  ["material", "GET", "/api/v1/materials/{variantId}", "get_material"],
87
99
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instruments/materialgraph",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -17,7 +17,7 @@
17
17
  }
18
18
  },
19
19
  "dependencies": {
20
- "@instruments/colorscope": "7.6.0"
20
+ "@instruments/colorscope": "9.0.1"
21
21
  },
22
22
  "license": "Proprietary",
23
23
  "engines": {
@@ -1,3 +1,5 @@
1
+ import type { MatchTarget } from "@instruments/colorscope/match";
2
+ import type { ColorResolution } from "@instruments/colorscope/naming";
1
3
  import type { SearchFilter } from "./search-refinement-types.js";
2
4
  import type { OpenEnum } from "./types.js";
3
5
  export type QuerySenseKind = OpenEnum<"brand" | "product" | "paint_identity" | "category" | "material" | "colour" | "attribute" | "attribute_value" | "certification">;
@@ -34,6 +36,8 @@ export interface CanonicalLexicalAuthorityReceipt {
34
36
  digest?: string;
35
37
  }
36
38
  export interface CanonicalLexicalReading {
39
+ matchTarget?: MatchTarget;
40
+ colorResolution?: ColorResolution;
37
41
  authority: OpenEnum<"taxonomy" | "colorscope">;
38
42
  identity: string;
39
43
  outcome: OpenEnum<"equivalent" | "ambiguous" | "declined">;
@@ -181,7 +185,7 @@ export interface QueryAmbiguityReceipt {
181
185
  }
182
186
  export interface QueryCategoryScopeReceipt {
183
187
  source: OpenEnum<"caller" | "anchor">;
184
- mechanism: OpenEnum<"sql-predicate" | "allowlist" | "prune">;
188
+ mechanism: OpenEnum<"sql-predicate" | "provider-filter" | "allowlist" | "prune">;
185
189
  variantCount: number | null;
186
190
  ceiling: number;
187
191
  specScanBounded?: boolean;
@@ -1,7 +1,9 @@
1
+ import type { MatchTarget } from "@instruments/colorscope/match";
1
2
  /**
2
3
  * Colour-name resolution (GET `/api/v1/search/colours/resolve`): the resolved
3
4
  * colour, and whether the named paint is a variant in the catalogue.
4
5
  */
6
+ import type { ColorResolution } from "@instruments/colorscope/naming";
5
7
  import type { CorpusScope } from "./corpus-scope-types.js";
6
8
  import type { VariantId } from "./identifiers.js";
7
9
  import type { OpenEnum } from "./types.js";
@@ -49,7 +51,21 @@ export type ResolveColourVariant = ({
49
51
  reason: OpenEnum<"reference-colour" | "descriptive-colour" | "no-paint-identity" | "generic-colour" | "several-paints">;
50
52
  };
51
53
  export interface ResolveColourResponse {
54
+ /** Examples within the governed range. They do not replace its representative or bounds. */
55
+ rangeSamples?: string[];
56
+ /** Explicit manufacturer choices for an ambiguous paint name. Never selected automatically. */
57
+ alternatives?: Array<{
58
+ query: string;
59
+ name: string;
60
+ hex: string;
61
+ libraryId: string;
62
+ libraryName: string;
63
+ code?: string;
64
+ }>;
65
+ /** Generic meaning; maker-specific paint identity is carried by match. */
66
+ genericResolution: ColorResolution;
52
67
  match: {
68
+ matchTarget: MatchTarget;
53
69
  hex: string;
54
70
  name: string;
55
71
  code?: string;
@@ -11,7 +11,8 @@
11
11
  import type { ProductId, VariantId } from "./identifiers.js";
12
12
  import type { OpenEnum, SearchData, SearchResponse } from "./types.js";
13
13
  /**
14
- * The lean `view:"card"` result item — identity + name + thumbnail + score.
14
+ * The lean `view:"card"` result item — identity + name + code + thumbnail +
15
+ * score.
15
16
  *
16
17
  * A PROJECTION, not a smaller answer: a field the card omits (palette, verdict,
17
18
  * signals, availability) is unread here, never known-absent. Re-read the same
@@ -30,6 +31,14 @@ export interface SearchCardItem {
30
31
  name: string;
31
32
  variantName: string | null;
32
33
  imageUrl: string | null;
34
+ /**
35
+ * The manufacturer's own item code, the same key the full item carries.
36
+ * Reach for it when two cards read alike: `name` is the PRODUCT name, and a
37
+ * paint product is a whole collection, so brand, product name and variant
38
+ * name together are shared by most of the catalogue. ABSENT means no code is
39
+ * recorded, never that the variant cannot be ordered.
40
+ */
41
+ manufacturerCode?: string;
33
42
  projectSaveCapability?: "allowed";
34
43
  sourceStatus?: "provisional";
35
44
  score: number;
@@ -122,7 +122,7 @@ export interface SearchInput {
122
122
  * demotes a failed/missing preferred hit WITHIN its page only.
123
123
  */
124
124
  preferences?: SearchFilter[];
125
- /** Page size — the size of ONE page, never a bound on the match set. */
125
+ /** Results per page (default 60, max 60), never a bound on the match set. */
126
126
  limit?: number;
127
127
  /** The previous response's `cursor`, passed back verbatim. Never synthesise one. */
128
128
  cursor?: Cursor;
@@ -24,16 +24,42 @@ export interface SearchRerankReport {
24
24
  colourWeight?: number;
25
25
  colourLabel?: string;
26
26
  }
27
- /** Stage counts retained when an explain-enabled search returns no results. */
27
+ /**
28
+ * A part of the search that can fail without stopping it.
29
+ *
30
+ * Coarse on purpose: a caller needs to know that something did not answer, not
31
+ * which provider it was. OPEN, and it will grow — read it with a default
32
+ * branch.
33
+ */
34
+ export type SearchDegradedPart = OpenEnum<"filter-coverage" | "term-coverage">;
35
+ /**
36
+ * Which parts of the search did not answer, on EVERY response (MG-1913).
37
+ *
38
+ * `parts: []` says no part reported a failure. It does NOT promise every check
39
+ * ran: a check the request never needed is skipped rather than failed. ABSENT
40
+ * means the response came from a server that does not report this, never that
41
+ * nothing was degraded.
42
+ */
43
+ export interface SearchDegraded {
44
+ parts: SearchDegradedPart[];
45
+ }
46
+ /** Stage counts retained when a search returns no results. */
28
47
  export interface SearchEmptyOutcomeCounts {
29
48
  retrieved: number;
30
49
  afterPrune: number;
31
50
  final: number;
32
51
  }
33
52
  /**
34
- * Explain-only evidence for why a completed search returned no results.
35
- * `proven-corpus-empty` is exhaustive; every other empty remains explicitly
36
- * unproven rather than being presented as catalogue absence.
53
+ * Why a search returned no results, on EVERY empty response (MG-1911).
54
+ *
55
+ * `proven-corpus-empty` is exhaustive and is the only member that supports
56
+ * telling someone the catalogue holds nothing. `unproven-empty` is an honest
57
+ * end to a search that ran without establishing that. `search-degraded` means
58
+ * part of the search did not answer, so the empty page describes the runtime
59
+ * rather than the catalogue, and the right response is to retry.
60
+ *
61
+ * Read it by `kind` with a default branch: this union has grown once and the
62
+ * reason and basis enums are open.
37
63
  */
38
64
  export type SearchEmptyOutcome = {
39
65
  kind: "proven-corpus-empty";
@@ -46,6 +72,12 @@ export type SearchEmptyOutcome = {
46
72
  reason: OpenEnum<"allowlist-truncated" | "retrieval-window-not-exhaustive" | "source-empty" | "post-retrieval-rejected" | "pagination-empty" | "no-authoritative-empty-proof">;
47
73
  sourceEmpty?: boolean | null;
48
74
  counts?: SearchEmptyOutcomeCounts;
75
+ } | {
76
+ kind: "search-degraded";
77
+ /** Which parts did not answer. Coarse: never a provider's name. */
78
+ parts: SearchDegradedPart[];
79
+ sourceEmpty?: boolean | null;
80
+ counts?: SearchEmptyOutcomeCounts;
49
81
  };
50
82
  /** Explain-only coverage of substantive query terms in the lexical projection. */
51
83
  export interface SearchTermCoverageReceipt {
@@ -53,10 +85,63 @@ export interface SearchTermCoverageReceipt {
53
85
  terms: string[];
54
86
  note?: string;
55
87
  }
56
- /** Explain-only outcome receipts shared by full and card search responses. */
88
+ /** The Search workflow run a ledger receipt belongs to. */
89
+ export interface SearchRunRef {
90
+ contextId: string;
91
+ runId: string;
92
+ schemaVersion: 1;
93
+ }
94
+ /** One artifact a Search workflow step read or wrote. */
95
+ export interface SearchRunArtifactRef {
96
+ artifactId: string;
97
+ kind: string;
98
+ producedBy: string;
99
+ runRef: SearchRunRef;
100
+ schemaVersion: 1;
101
+ }
102
+ /** What one Search workflow step did: its reads, its write and its time. */
103
+ export interface SearchStageReceipt {
104
+ stageId: string;
105
+ status: "succeeded";
106
+ /** The step's own work, excluding reading and writing its artifacts. */
107
+ durationMs: number;
108
+ inputArtifacts: SearchRunArtifactRef[];
109
+ outputArtifact: SearchRunArtifactRef;
110
+ inputCount: number | null;
111
+ outputCount: number | null;
112
+ runRef: SearchRunRef;
113
+ /** The outcome the step chose, when it chooses one. */
114
+ outcome?: string;
115
+ /** The arm a fork took and why. */
116
+ branch?: {
117
+ decision: string;
118
+ reason: string;
119
+ };
120
+ }
121
+ /** One ledger line: a step's receipt and its span since the run opened. */
122
+ export interface SearchRunLedgerEntry {
123
+ receipt: SearchStageReceipt;
124
+ /** The nested workflows the step ran under, outermost first. */
125
+ workflowPath: string[];
126
+ startedAtMs: number;
127
+ endedAtMs: number;
128
+ }
129
+ /**
130
+ * Outcome receipts shared by full and card search responses. `degraded` and
131
+ * `emptyOutcome` are on every response; `termCoverage` and `explain` are
132
+ * explain-only.
133
+ */
57
134
  export interface SearchResponseExplainReceipts {
135
+ degraded?: SearchDegraded;
58
136
  emptyOutcome?: SearchEmptyOutcome;
59
137
  termCoverage?: SearchTermCoverageReceipt;
138
+ /**
139
+ * Present under `explain` when the Search workflow answered the request:
140
+ * every step receipt, in completion order. Absent when the engine answered.
141
+ */
142
+ explain?: {
143
+ ledger: readonly SearchRunLedgerEntry[];
144
+ };
60
145
  }
61
146
  /** One stage in the explain-only ledger of transformations that actually ran. */
62
147
  export type SearchQueryTransformStage = {
package/types.d.ts CHANGED
@@ -29,7 +29,7 @@ import type { BySpecVerdict } from "./by-spec-types.js";
29
29
  */
30
30
  import type { CorpusScopeReceipt } from "./corpus-scope-types.js";
31
31
  import type { Cursor, ProductId, VariantId } from "./identifiers.js";
32
- import type { MaterialDetail, MaterialTile } from "./material-types.js";
32
+ import type { MaterialDetail, MaterialTile, SiblingTile } from "./material-types.js";
33
33
  import type { QueryUnderstanding } from "./query-understanding-types.js";
34
34
  import type { CollapsedVariant, SearchAnatomyMember } from "./search-collapse-types.js";
35
35
  import type { MoodInterpretation } from "./search-mood-types.js";
@@ -83,7 +83,7 @@ export interface MaterialColour {
83
83
  }
84
84
  /** Where the served image came from. */
85
85
  export type ImageSource = OpenEnum<"r2" | "origin">;
86
- export type { DimensionEntry, MaterialAvailability, MaterialDetail, MaterialFacet, MaterialSuccessor, MaterialTile, } from "./material-types.js";
86
+ export type { DimensionEntry, MaterialAvailability, MaterialDetail, MaterialFacet, MaterialSuccessor, MaterialTile, SiblingTile, } from "./material-types.js";
87
87
  /** Per-signal scores, present on a result when `explain` was requested. */
88
88
  export interface SearchResultSignals {
89
89
  /** Voyage similarity in the dedicated variant text-portrait space. */
@@ -602,10 +602,10 @@ export interface PairingsResponse {
602
602
  export interface MaterialResponse {
603
603
  material: MaterialDetail;
604
604
  /** Present only when `include: "siblings"` was requested. */
605
- siblings?: MaterialTile[];
605
+ siblings?: SiblingTile[];
606
606
  }
607
607
  export interface SiblingsResponse {
608
- siblings: MaterialTile[];
608
+ siblings: SiblingTile[];
609
609
  }
610
610
  /**
611
611
  * Batch read of tile projections. `materials` is NOT positional — resolve by