@instruments/materialgraph 0.15.0 → 0.16.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/by-colour-types.d.ts +15 -0
- package/codes-client.d.ts +1 -1
- package/codes-client.js +1 -1
- package/codes-types.d.ts +3 -3
- package/composition-types.d.ts +21 -0
- package/exploration-types.d.ts +2 -0
- package/index.d.ts +1 -0
- package/package.json +1 -1
- package/resolve-types.d.ts +1 -1
- package/search-response-receipt-types.d.ts +90 -0
- package/search-response-receipt-types.js +1 -0
- package/search-window-types.d.ts +17 -0
- package/search-window-types.js +1 -0
- package/types.d.ts +10 -10
package/by-colour-types.d.ts
CHANGED
|
@@ -100,6 +100,15 @@ export interface ColourFamilyGate {
|
|
|
100
100
|
*/
|
|
101
101
|
dropped: number;
|
|
102
102
|
}
|
|
103
|
+
/** Receipt for the hard category gate and its treatment of unknown typing. */
|
|
104
|
+
export interface ColourCategoryGate {
|
|
105
|
+
/** Category names or keys the caller asked the gate to keep. */
|
|
106
|
+
requested: string[];
|
|
107
|
+
/** Only accepted primary product types can establish membership. */
|
|
108
|
+
requiresAcceptedPrimaryProductType: true;
|
|
109
|
+
/** Unknown/unclassified variants were ineligible, not proven non-members. */
|
|
110
|
+
unclassifiedVariantsExcluded: true;
|
|
111
|
+
}
|
|
103
112
|
/**
|
|
104
113
|
* Receipt for the colour-identity collapse that turns a variant-grain ranking
|
|
105
114
|
* into a page of TILES — one per (brand, product, dominant hex), one per stored
|
|
@@ -177,6 +186,12 @@ export interface ByColourResponse {
|
|
|
177
186
|
* what says so in counts rather than adjectives.
|
|
178
187
|
*/
|
|
179
188
|
familyGate?: ColourFamilyGate;
|
|
189
|
+
/**
|
|
190
|
+
* Present only when `category` was asked for. It states that variants without
|
|
191
|
+
* an accepted primary product type were excluded by the hard gate; absence
|
|
192
|
+
* means no category gate ran.
|
|
193
|
+
*/
|
|
194
|
+
categoryGate?: ColourCategoryGate;
|
|
180
195
|
/**
|
|
181
196
|
* What the colour-identity collapse cost this page. Matches are TILES: a page
|
|
182
197
|
* can be SHORTER than `limit` when the pool collapsed harder than the
|
package/codes-client.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ export declare class CodesClient {
|
|
|
45
45
|
* The vocabulary for stating a code context (GET `/api/v1/codes/context`):
|
|
46
46
|
* seeded jurisdictions and their coverage tier, the occupancy groups the
|
|
47
47
|
* registry keys on, finish locations, dimensions, classification scales with
|
|
48
|
-
* classes ordered best-first, and which `
|
|
48
|
+
* classes ordered best-first, and which `room` term correlates to which
|
|
49
49
|
* regulatory axes.
|
|
50
50
|
*
|
|
51
51
|
* Start here — every value the other two calls accept is listed in this one
|
package/codes-client.js
CHANGED
|
@@ -14,7 +14,7 @@ export class CodesClient {
|
|
|
14
14
|
* The vocabulary for stating a code context (GET `/api/v1/codes/context`):
|
|
15
15
|
* seeded jurisdictions and their coverage tier, the occupancy groups the
|
|
16
16
|
* registry keys on, finish locations, dimensions, classification scales with
|
|
17
|
-
* classes ordered best-first, and which `
|
|
17
|
+
* classes ordered best-first, and which `room` term correlates to which
|
|
18
18
|
* regulatory axes.
|
|
19
19
|
*
|
|
20
20
|
* Start here — every value the other two calls accept is listed in this one
|
package/codes-types.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export interface CodeContextRequest {
|
|
|
62
62
|
*/
|
|
63
63
|
spaceType?: string;
|
|
64
64
|
/**
|
|
65
|
-
*
|
|
65
|
+
* A `room` term id (e.g. `"hotel_room"`) to correlate the regulatory axes
|
|
66
66
|
* from. Explicit `occupancyGroup` / `spaceType` always win. A room that
|
|
67
67
|
* correlates to neither axis is a 400 naming the axis — never a guess.
|
|
68
68
|
*/
|
|
@@ -224,7 +224,7 @@ export interface ResolvedCodeContext {
|
|
|
224
224
|
spaceType: string;
|
|
225
225
|
sprinklered: boolean;
|
|
226
226
|
basis: OpenEnum<"explicit" | "derived_from_room">;
|
|
227
|
-
/** The `
|
|
227
|
+
/** The `room` term the axes were correlated from, or null. */
|
|
228
228
|
roomType: string | null;
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
@@ -271,7 +271,7 @@ export interface CodeContextResponse {
|
|
|
271
271
|
/** Ordered BEST FIRST: index 0 outranks index 1. */
|
|
272
272
|
classes: string[];
|
|
273
273
|
}[];
|
|
274
|
-
/** `
|
|
274
|
+
/** `room` → regulatory axes. `null` where the registry refuses to correlate. */
|
|
275
275
|
roomCorrelations: {
|
|
276
276
|
roomType: string;
|
|
277
277
|
label: string;
|
package/composition-types.d.ts
CHANGED
|
@@ -86,6 +86,23 @@ export interface CompliancePresetRule {
|
|
|
86
86
|
export interface CompliancePreset {
|
|
87
87
|
rules: CompliancePresetRule[];
|
|
88
88
|
}
|
|
89
|
+
/** Exact project regulatory axes used to attach bounded code citations. */
|
|
90
|
+
export interface ProgrammeRegulatoryAxes {
|
|
91
|
+
jurisdictionId: string;
|
|
92
|
+
occupancyGroup: string;
|
|
93
|
+
sprinklered: boolean;
|
|
94
|
+
}
|
|
95
|
+
/** One caller-declared Programme space. `spaceType` remains open descriptive text. */
|
|
96
|
+
export interface ComposeDeclaredSpace {
|
|
97
|
+
name: string;
|
|
98
|
+
spaceType?: string;
|
|
99
|
+
/** Exact active canonical `room` id used for bounded code evaluation. */
|
|
100
|
+
regulatoryRoomType?: string;
|
|
101
|
+
}
|
|
102
|
+
/** The spaces this run is explicitly for; omit to retain brief inference. */
|
|
103
|
+
export interface ComposeDeclaredScope {
|
|
104
|
+
spaces: ComposeDeclaredSpace[];
|
|
105
|
+
}
|
|
89
106
|
/**
|
|
90
107
|
* The `inputJson` for a `compose-material-schemes` run. `batchId` is required;
|
|
91
108
|
* everything else has a server default. `anchors` (max 24) carry externally
|
|
@@ -101,6 +118,10 @@ export interface ComposeMaterialSchemesInput {
|
|
|
101
118
|
exclusions?: SchemeExclusions;
|
|
102
119
|
anchors?: ComposeAnchorInput[];
|
|
103
120
|
compliancePreset?: CompliancePreset;
|
|
121
|
+
/** Omit to leave Programme code coverage explicitly unevaluated. */
|
|
122
|
+
regulatoryAxes?: ProgrammeRegulatoryAxes;
|
|
123
|
+
/** Explicit caller-held space facts; regulatoryRoomType is never inferred. */
|
|
124
|
+
scope?: ComposeDeclaredScope;
|
|
104
125
|
}
|
|
105
126
|
/**
|
|
106
127
|
* The state of one criterion verdict cell (MG-627: the shared MaterialGraph
|
package/exploration-types.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export type * from "./material-asset-types.js";
|
|
|
38
38
|
export type * from "./material-block-types.js";
|
|
39
39
|
export type * from "./schema-resource-types.js";
|
|
40
40
|
export type * from "./search-refinement-types.js";
|
|
41
|
+
export type * from "./search-window-types.js";
|
|
41
42
|
export { CERTIFICATION_PROGRAMME_ATTRIBUTE_ID } from "./spec-types.js";
|
|
42
43
|
export type * from "./spec-types.js";
|
|
43
44
|
export { certificationProgramme, certificationProgrammeCriterion, hasSpec, specCriterion, specRangeCriterion, specTerm, } from "./specifications.js";
|
package/package.json
CHANGED
package/resolve-types.d.ts
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
* - `category` — a product-category taxonomy node key.
|
|
26
26
|
* - `attribute` — a registry attribute id: the LEFT half of an `attribute:value`
|
|
27
27
|
* pair, for `mg.bySpec()` or `search({ filters })`.
|
|
28
|
-
* - `attribute_value` — a value-dictionary term, namespaced (`
|
|
28
|
+
* - `attribute_value` — a value-dictionary term, namespaced (`sheen.matte`):
|
|
29
29
|
* the RIGHT half.
|
|
30
30
|
* - `jurisdiction` — a code jurisdiction id (`us-tx`), for `mg.codeAdvisory()`.
|
|
31
31
|
* - `occupancy_group` — an IBC occupancy group (`R-1`), the other axis the code
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module sdk/search-response-receipt-types
|
|
3
|
+
* @description Inspectable routing, rerank, and compound-constraint receipts
|
|
4
|
+
* emitted by ordinary Search responses.
|
|
5
|
+
*/
|
|
6
|
+
import type { OpenEnum } from "./types.js";
|
|
7
|
+
/** The single candidate source a query resolved to. */
|
|
8
|
+
export type SearchMode = OpenEnum<"image" | "colour" | "text" | "lexical" | "entity-browse">;
|
|
9
|
+
/** Rerank-term report (absent in colour mode — there colour IS the source). */
|
|
10
|
+
export interface SearchRerankReport {
|
|
11
|
+
colour?: OpenEnum<"ok" | "failed" | "skipped">;
|
|
12
|
+
colourWeight?: number;
|
|
13
|
+
colourLabel?: string;
|
|
14
|
+
}
|
|
15
|
+
/** One stage in the explain-only ledger of transformations that actually ran. */
|
|
16
|
+
export type SearchQueryTransformStage = {
|
|
17
|
+
stage: OpenEnum<"normalise" | "resolve-spec" | "resolve-paint" | "resolve-brand">;
|
|
18
|
+
applied: true;
|
|
19
|
+
} | {
|
|
20
|
+
stage: OpenEnum<"normalise" | "resolve-spec" | "resolve-paint" | "resolve-brand">;
|
|
21
|
+
applied: false;
|
|
22
|
+
reason: string;
|
|
23
|
+
};
|
|
24
|
+
/** Explain-only category gate selected by query understanding. */
|
|
25
|
+
export interface SearchCategoryAnchor {
|
|
26
|
+
productTypeId: string;
|
|
27
|
+
displayName: string;
|
|
28
|
+
similarity: number;
|
|
29
|
+
margin: number | null;
|
|
30
|
+
source: OpenEnum<"synonym" | "display-name" | "vector">;
|
|
31
|
+
applied: boolean;
|
|
32
|
+
}
|
|
33
|
+
/** Explain-only brand gate selected by query understanding. */
|
|
34
|
+
export interface SearchBrandAnchor {
|
|
35
|
+
brandSlug: string;
|
|
36
|
+
brandName: string;
|
|
37
|
+
confidence: number;
|
|
38
|
+
margin: number | null;
|
|
39
|
+
tier: OpenEnum<"exact_id" | "exact_alias" | "lexical" | "semantic">;
|
|
40
|
+
variantCount: number;
|
|
41
|
+
applied: boolean;
|
|
42
|
+
}
|
|
43
|
+
/** A real brand candidate the engine deliberately declined to gate on. */
|
|
44
|
+
export interface SearchBrandSkip {
|
|
45
|
+
reason: OpenEnum<"ambiguous" | "weak-tier" | "too-broad">;
|
|
46
|
+
candidates?: string[];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* EXPLAIN-only receipt of the query shape that executed. This is distinct from
|
|
50
|
+
* the separate Search Plan compiler operation: it reports execution and never
|
|
51
|
+
* causes it.
|
|
52
|
+
*/
|
|
53
|
+
export interface SearchExecutionPlan {
|
|
54
|
+
grain: OpenEnum<"variant" | "product">;
|
|
55
|
+
weights: {
|
|
56
|
+
image: number;
|
|
57
|
+
category: number;
|
|
58
|
+
colour: number;
|
|
59
|
+
lexical: number;
|
|
60
|
+
text: number;
|
|
61
|
+
};
|
|
62
|
+
queryTransform: SearchQueryTransformStage[];
|
|
63
|
+
categoryAnchor?: SearchCategoryAnchor;
|
|
64
|
+
brandAnchor?: SearchBrandAnchor;
|
|
65
|
+
brandSkipped?: SearchBrandSkip;
|
|
66
|
+
}
|
|
67
|
+
/** Why a compound colour constraint returned a full or short page. */
|
|
68
|
+
export interface CompoundColourAbundanceReceipt {
|
|
69
|
+
grain: OpenEnum<"variant" | "product">;
|
|
70
|
+
requested: number;
|
|
71
|
+
eligible: number;
|
|
72
|
+
candidateWindow: number;
|
|
73
|
+
sourceExhausted: boolean;
|
|
74
|
+
state: OpenEnum<"filled" | "corpus_scarcity" | "evidence_unavailable" | "retrieval_window_exhausted">;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Eligibility proof for an explicit or taxonomy-backed colour inside a compound
|
|
78
|
+
* text query. Counts describe the bounded candidate pool, not the whole corpus.
|
|
79
|
+
*/
|
|
80
|
+
export interface CompoundColourConstraintReceipt {
|
|
81
|
+
provenance: OpenEnum<"explicit" | "detected-strong">;
|
|
82
|
+
family: string;
|
|
83
|
+
queryHexes: string[];
|
|
84
|
+
considered: number;
|
|
85
|
+
kept: number;
|
|
86
|
+
dropped: number;
|
|
87
|
+
unknown: number;
|
|
88
|
+
adjacent: number;
|
|
89
|
+
abundance?: CompoundColourAbundanceReceipt;
|
|
90
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** The bounded candidate window that produced a search page. */
|
|
2
|
+
export interface SearchWindowReceipt {
|
|
3
|
+
/** Versioned budget profile; interpret the remaining fields under this version. */
|
|
4
|
+
profile: "interactive-r1" | (string & {});
|
|
5
|
+
/** Candidate depth used by the final retrieval. */
|
|
6
|
+
candidateTier: number;
|
|
7
|
+
/** Every candidate retrieval, including required fallbacks and optional recovery. */
|
|
8
|
+
retrievalRounds: number;
|
|
9
|
+
/** Candidate-retrieval wall time only, in milliseconds. */
|
|
10
|
+
retrievalMs: number;
|
|
11
|
+
/** True when the serving source proved there were no more candidates. */
|
|
12
|
+
exhaustive: boolean;
|
|
13
|
+
/** True when product-grain scarcity caused one jump to the deep ceiling. */
|
|
14
|
+
deepened: boolean;
|
|
15
|
+
/** True when a still-short page exhausted its bounded recovery allowance. */
|
|
16
|
+
budgetExhausted: boolean;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { BySpecVerdict } from "./by-spec-types.js";
|
|
|
5
5
|
* These interfaces intentionally have NO runtime dependency on any
|
|
6
6
|
* `@materialgraph/*` package — they are a standalone, publishable mirror of the
|
|
7
7
|
* shapes in `apps/web/public/openapi.yaml` and the captured fixtures under
|
|
8
|
-
* `
|
|
8
|
+
* `src/__tests__/fixtures/v0.5.0/`. The `contract-parity` test re-checks them
|
|
9
9
|
* against the real Zod schemas so the mirror cannot silently drift.
|
|
10
10
|
* TOLERANT-PARSING CONTRACT: the public surface declares open response enums —
|
|
11
11
|
* "clients must tolerate unknown enum values and unknown fields". Every union
|
|
@@ -31,7 +31,9 @@ import type { Cursor, ProductId, VariantId } from "./identifiers.js";
|
|
|
31
31
|
import type { MaterialDetail, MaterialTile } from "./material-types.js";
|
|
32
32
|
import type { QueryUnderstanding } from "./query-understanding-types.js";
|
|
33
33
|
import type { SearchDisambiguation, SearchSuggestion } from "./search-refinement-types.js";
|
|
34
|
-
|
|
34
|
+
import type { CompoundColourConstraintReceipt, SearchExecutionPlan, SearchMode, SearchRerankReport } from "./search-response-receipt-types.js";
|
|
35
|
+
import type { SearchWindowReceipt } from "./search-window-types.js";
|
|
36
|
+
export type * from "./search-response-receipt-types.js";
|
|
35
37
|
export type OpenEnum<T extends string> = T | (string & {});
|
|
36
38
|
/**
|
|
37
39
|
* A JSON value, recursively — exactly what survives a `jsonb` round-trip
|
|
@@ -389,14 +391,6 @@ export interface SearchRefinementReceipt {
|
|
|
389
391
|
schemaVersion: string;
|
|
390
392
|
projectionVersion: number;
|
|
391
393
|
}
|
|
392
|
-
/** The single candidate source a query resolved to. */
|
|
393
|
-
export type SearchMode = OpenEnum<"image" | "colour" | "text" | "lexical" | "entity-browse">;
|
|
394
|
-
/** Rerank-term report (absent in colour mode — there colour IS the source). */
|
|
395
|
-
export interface SearchRerankReport {
|
|
396
|
-
colour?: OpenEnum<"ok" | "failed" | "skipped">;
|
|
397
|
-
colourWeight?: number;
|
|
398
|
-
colourLabel?: string;
|
|
399
|
-
}
|
|
400
394
|
/**
|
|
401
395
|
* The search response envelope. `view` discriminates the `results` union:
|
|
402
396
|
* `"full"` (default) carries {@link SearchResultItem}s, `"card"` the lean
|
|
@@ -418,7 +412,13 @@ export interface SearchResponse {
|
|
|
418
412
|
maxScore: number;
|
|
419
413
|
/** Opaque keyset for the next page. Absent = end of the walk, not an error. */
|
|
420
414
|
cursor?: Cursor;
|
|
415
|
+
/** Boundedness and retrieval-cost receipt on current Search responses. */
|
|
416
|
+
window?: SearchWindowReceipt;
|
|
421
417
|
rerank?: SearchRerankReport;
|
|
418
|
+
/** Hard compound-colour eligibility and abundance receipt, when applied. */
|
|
419
|
+
colourConstraint?: CompoundColourConstraintReceipt;
|
|
420
|
+
/** Explain-only receipt of the query shape and transform ledger that ran. */
|
|
421
|
+
plan?: SearchExecutionPlan;
|
|
422
422
|
counts?: SearchCounts;
|
|
423
423
|
/**
|
|
424
424
|
* The `#rrggbb` colours the colour signal ACTUALLY ran on, after
|