@instruments/materialgraph 3.1.0 → 3.3.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/association-types.d.ts +20 -20
- package/baseline-types.d.ts +112 -0
- package/baseline-types.js +1 -0
- package/brand-types.d.ts +6 -6
- package/by-spec-types.d.ts +6 -6
- package/catalog-discovery-types.d.ts +4 -4
- package/categories-client.d.ts +3 -3
- package/category-types.d.ts +18 -18
- package/client-config.d.ts +2 -2
- package/client-response-schema.d.ts +2 -2
- package/client-response-schema.js +5 -5
- package/client-vocabulary.d.ts +2 -0
- package/client-vocabulary.js +9 -1
- package/client.d.ts +32 -3
- package/client.js +54 -14
- package/color-profiles-types.d.ts +8 -8
- package/color-wire-types.d.ts +6 -6
- package/colors-client.d.ts +3 -3
- package/discovery-context-types.d.ts +8 -8
- package/errors.d.ts +12 -13
- package/errors.js +84 -74
- package/find-sampled-together-types.d.ts +6 -6
- package/find-variants-by-color-types.d.ts +31 -30
- package/find-variants-by-vector-types.d.ts +13 -13
- package/get-variant-demand-types.d.ts +69 -0
- package/get-variant-demand-types.js +1 -0
- package/get-variant-types.d.ts +7 -7
- package/http-transport.d.ts +14 -10
- package/http-transport.js +14 -12
- package/image-reference-types.d.ts +2 -2
- package/index.d.ts +3 -1
- package/json.d.ts +18 -0
- package/json.js +36 -0
- package/list-enum-values-types.d.ts +8 -8
- package/list-sampled-together-pairs-types.d.ts +11 -11
- package/list-variant-facets-types.d.ts +8 -8
- package/list-variants-types.d.ts +42 -32
- package/material-asset-types.d.ts +26 -26
- package/material-block-types.d.ts +7 -7
- package/material-types.d.ts +6 -6
- package/nearest-paints-types.d.ts +8 -8
- package/operation-responses.d.ts +8 -2
- package/operations.d.ts +1 -1
- package/operations.generated.d.ts +1 -1
- package/operations.generated.js +9 -0
- package/operations.js +1 -1
- package/package.json +1 -1
- package/parse-operation-response.d.ts +4 -3
- package/parse-operation-response.js +112 -135
- package/resolve-color-types.d.ts +6 -6
- package/resolve-variant-types.d.ts +10 -10
- package/response-schema-catalog.d.ts +8 -0
- package/response-schema-catalog.js +82 -0
- package/response-schemas.d.ts +32 -3
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +34 -28
- package/response-schemas.js +5 -77
- package/schema-resource-types.d.ts +12 -12
- package/search-catalog-subset-types.d.ts +2 -2
- package/search-variants-types.d.ts +12 -12
- package/source-material-types.d.ts +6 -6
- package/source-material.js +2 -32
- package/types.d.ts +43 -45
- package/webmcp.d.ts +10 -4
- package/webmcp.generated.js +5 -4
package/response-schemas.js
CHANGED
|
@@ -27,86 +27,14 @@
|
|
|
27
27
|
* client does not load it, and it is parsed on the first `responseSchema()`
|
|
28
28
|
* call rather than on import.
|
|
29
29
|
*/
|
|
30
|
-
import {
|
|
31
|
-
import { RESPONSE_SCHEMA_CATALOG_JSON } from "./response-schemas.generated.js";
|
|
30
|
+
import { JSON_SCHEMA_DIALECT, buildResponseSchema, } from "./response-schema-catalog.js";
|
|
32
31
|
export { RESPONSE_SCHEMA_API_VERSION, RESPONSE_SCHEMA_OPERATION_IDS, } from "./response-schemas.generated.js";
|
|
33
|
-
const JSON_SCHEMA_DIALECT = "https://json-schema.org/draft/2020-12/schema";
|
|
34
|
-
const DEFINITION_PREFIX = "#/$defs/";
|
|
35
|
-
const isJsonSchemaMap = (value) => typeof value === "object" &&
|
|
36
|
-
value !== null &&
|
|
37
|
-
Object.values(value).every((schema) => typeof schema === "object" && schema !== null && !Array.isArray(schema));
|
|
38
|
-
const isCatalog = (value) => typeof value === "object" &&
|
|
39
|
-
value !== null &&
|
|
40
|
-
"definitions" in value &&
|
|
41
|
-
isJsonSchemaMap(value.definitions) &&
|
|
42
|
-
"operations" in value &&
|
|
43
|
-
isJsonSchemaMap(value.operations);
|
|
44
|
-
let parsedCatalog;
|
|
45
|
-
const loadCatalog = () => {
|
|
46
|
-
if (parsedCatalog === undefined) {
|
|
47
|
-
const parsed = JSON.parse(RESPONSE_SCHEMA_CATALOG_JSON);
|
|
48
|
-
if (!isCatalog(parsed)) {
|
|
49
|
-
throw MaterialGraphError.unexpected("The response schema catalog is malformed");
|
|
50
|
-
}
|
|
51
|
-
parsedCatalog = parsed;
|
|
52
|
-
}
|
|
53
|
-
return parsedCatalog;
|
|
54
|
-
};
|
|
55
|
-
/** Add every definition `value` reaches, transitively, to `into`. */
|
|
56
|
-
const collectReferences = (catalog, value, into) => {
|
|
57
|
-
if (Array.isArray(value)) {
|
|
58
|
-
for (const item of value) {
|
|
59
|
-
collectReferences(catalog, item, into);
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
if (typeof value !== "object" || value === null) {
|
|
64
|
-
return;
|
|
65
|
-
}
|
|
66
|
-
for (const [key, child] of Object.entries(value)) {
|
|
67
|
-
if (key === "$ref" &&
|
|
68
|
-
typeof child === "string" &&
|
|
69
|
-
child.startsWith(DEFINITION_PREFIX)) {
|
|
70
|
-
const name = child
|
|
71
|
-
.slice(DEFINITION_PREFIX.length)
|
|
72
|
-
.replaceAll("~1", "/")
|
|
73
|
-
.replaceAll("~0", "~");
|
|
74
|
-
if (!into.has(name)) {
|
|
75
|
-
into.add(name);
|
|
76
|
-
collectReferences(catalog, catalog.definitions[name], into);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
collectReferences(catalog, child, into);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
32
|
/**
|
|
85
33
|
* The success-response schema for one operation, self-contained and carrying
|
|
86
34
|
* only the definitions it reaches. Each call returns a fresh copy, so a caller
|
|
87
35
|
* that annotates or mutates it cannot change what the next caller gets.
|
|
88
36
|
*/
|
|
89
|
-
export const responseSchema = (operationId) => {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
: undefined;
|
|
94
|
-
if (root === undefined) {
|
|
95
|
-
throw MaterialGraphError.unexpected(`No response schema for operation: ${operationId}`);
|
|
96
|
-
}
|
|
97
|
-
const names = new Set();
|
|
98
|
-
collectReferences(catalog, root, names);
|
|
99
|
-
const definitions = {};
|
|
100
|
-
for (const name of [...names].toSorted()) {
|
|
101
|
-
const definition = catalog.definitions[name];
|
|
102
|
-
if (definition !== undefined) {
|
|
103
|
-
definitions[name] = definition;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
const schema = {
|
|
107
|
-
$schema: JSON_SCHEMA_DIALECT,
|
|
108
|
-
...root,
|
|
109
|
-
...(names.size > 0 ? { $defs: definitions } : {}),
|
|
110
|
-
};
|
|
111
|
-
return structuredClone(schema);
|
|
112
|
-
};
|
|
37
|
+
export const responseSchema = (operationId) => ({
|
|
38
|
+
...buildResponseSchema(operationId),
|
|
39
|
+
$schema: JSON_SCHEMA_DIALECT,
|
|
40
|
+
});
|
|
@@ -11,13 +11,13 @@ export declare const SCHEMA_RESOURCE_OPERATION_IDS: {
|
|
|
11
11
|
readonly valueDictionaries: "list_schema_value_dictionaries";
|
|
12
12
|
};
|
|
13
13
|
export type SchemaResourceRequest = SchemaResource;
|
|
14
|
-
export
|
|
14
|
+
export interface SchemaLifecycle {
|
|
15
15
|
status: OpenEnum<"draft" | "active" | "deprecated">;
|
|
16
16
|
introducedIn: string;
|
|
17
17
|
deprecatedIn?: string;
|
|
18
18
|
supersededBy?: string;
|
|
19
|
-
}
|
|
20
|
-
export
|
|
19
|
+
}
|
|
20
|
+
export interface SchemaExternalMapping {
|
|
21
21
|
target: OpenEnum<"schema_org" | "ifc_pset" | "bsdd" | "iso_23387" | "eclass" | "gs1_gdm" | "gdsn" | "etim" | "uniclass">;
|
|
22
22
|
targetPath: string;
|
|
23
23
|
mappingType: OpenEnum<"direct" | "transform" | "derived" | "classification" | "semantic">;
|
|
@@ -27,9 +27,9 @@ export type SchemaExternalMapping = {
|
|
|
27
27
|
*/
|
|
28
28
|
matchStrength?: SchemaMatchStrength;
|
|
29
29
|
notes?: string;
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
export type SchemaMatchStrength = OpenEnum<"exact" | "close" | "broad" | "narrow" | "related">;
|
|
32
|
-
export
|
|
32
|
+
export interface SchemaValueDictionaryTerm {
|
|
33
33
|
id: string;
|
|
34
34
|
label: string;
|
|
35
35
|
aliases?: string[];
|
|
@@ -37,21 +37,21 @@ export type SchemaValueDictionaryTerm = {
|
|
|
37
37
|
externalMappings?: SchemaExternalMapping[];
|
|
38
38
|
semanticId: string;
|
|
39
39
|
lifecycle: SchemaLifecycle;
|
|
40
|
-
}
|
|
41
|
-
export
|
|
40
|
+
}
|
|
41
|
+
export interface SchemaValueDictionaryItem {
|
|
42
42
|
id: string;
|
|
43
43
|
name: string;
|
|
44
44
|
description: string;
|
|
45
45
|
terms: SchemaValueDictionaryTerm[];
|
|
46
46
|
semanticId: string;
|
|
47
47
|
lifecycle: SchemaLifecycle;
|
|
48
|
-
}
|
|
49
|
-
export
|
|
48
|
+
}
|
|
49
|
+
export interface SchemaResourceItemMap {
|
|
50
50
|
valueDictionaries: SchemaValueDictionaryItem;
|
|
51
|
-
}
|
|
52
|
-
export
|
|
51
|
+
}
|
|
52
|
+
export interface SchemaResourceResponse<K extends SchemaResource = SchemaResource> {
|
|
53
53
|
kind: K;
|
|
54
54
|
schemaVersion: string;
|
|
55
55
|
items: SchemaResourceItemMap[K][];
|
|
56
56
|
totalCount: number;
|
|
57
|
-
}
|
|
57
|
+
}
|
|
@@ -50,8 +50,8 @@ export type SearchCatalogSubset = OpenEnum<"samplizeOrderable" | "all" | "design
|
|
|
50
50
|
* the counts: a short page under a scope is a small SCOPED corpus, never a
|
|
51
51
|
* truncated one.
|
|
52
52
|
*/
|
|
53
|
-
export
|
|
53
|
+
export interface SearchCatalogSubsetReceipt {
|
|
54
54
|
scope: SearchCatalogSubset;
|
|
55
55
|
/** What the scope admits, in one sentence, for a human reader. */
|
|
56
56
|
description: string;
|
|
57
|
-
}
|
|
57
|
+
}
|
|
@@ -10,12 +10,12 @@
|
|
|
10
10
|
import type { ColorRangeCondition, FilterGroups, ListVariantsInclude, ListVariantsOutput, OptionalFilterGroups } from "./list-variants-types.js";
|
|
11
11
|
import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
12
12
|
/** Switches one of a previous answer's `choices`: its `handle`, and the `group` and `id` of the alternative to read it as. */
|
|
13
|
-
export
|
|
13
|
+
export interface SearchVariantsSelection {
|
|
14
14
|
group: string;
|
|
15
15
|
handle: string;
|
|
16
16
|
id: string;
|
|
17
|
-
}
|
|
18
|
-
export
|
|
17
|
+
}
|
|
18
|
+
export interface SearchVariantsInput {
|
|
19
19
|
/** Attribute ids to project under each item's `specifications`, as `listVariants()` takes. */
|
|
20
20
|
attributes?: string[];
|
|
21
21
|
/** The previous page's `pageInfo.endCursor`. Tied to the vocabulary version the query was read against, and not a `listVariants()` cursor. */
|
|
@@ -32,12 +32,12 @@ export type SearchVariantsInput = {
|
|
|
32
32
|
searchCatalogSubset?: SearchCatalogSubset;
|
|
33
33
|
/** Up to eight choices to switch, from the previous answer's `choices`. */
|
|
34
34
|
selections?: SearchVariantsSelection[];
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
/**
|
|
37
37
|
* What became of one phrase of the query. `filter` narrowed the page,
|
|
38
38
|
* `preference` only ranked it, `not_applied` did neither and `note` says why.
|
|
39
39
|
*/
|
|
40
|
-
export
|
|
40
|
+
export interface SearchVariantsUnderstood {
|
|
41
41
|
applied: "filter" | "preference" | "not_applied";
|
|
42
42
|
/** The parser's condition id. */
|
|
43
43
|
id: string;
|
|
@@ -47,33 +47,33 @@ export type SearchVariantsUnderstood = {
|
|
|
47
47
|
note?: string;
|
|
48
48
|
/** The query words it came from. */
|
|
49
49
|
text: string;
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
51
|
/** One reading of an ambiguous phrase. */
|
|
52
|
-
export
|
|
52
|
+
export interface SearchVariantsReading {
|
|
53
53
|
group: string;
|
|
54
54
|
id: string;
|
|
55
55
|
kind: string;
|
|
56
56
|
label: string;
|
|
57
57
|
/** Variants in search scope that hold this reading. */
|
|
58
58
|
variants?: number;
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
/** On an empty page: a change to the next call that returns variants. */
|
|
61
|
-
export
|
|
61
|
+
export interface SearchVariantsSuggestion {
|
|
62
62
|
/** The `leaveOut` entries to send. */
|
|
63
63
|
leaveOut?: string[];
|
|
64
64
|
note: string;
|
|
65
65
|
/** Variants the search returns with this change. */
|
|
66
66
|
variants: number;
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
68
|
/** A phrase with more than one meaning: the reading used, and the others a caller may switch to by `handle`. */
|
|
69
|
-
export
|
|
69
|
+
export interface SearchVariantsChoice {
|
|
70
70
|
alternatives: SearchVariantsReading[];
|
|
71
71
|
basis: string;
|
|
72
72
|
handle: string;
|
|
73
73
|
reason: string;
|
|
74
74
|
selected: SearchVariantsReading;
|
|
75
75
|
text: string;
|
|
76
|
-
}
|
|
76
|
+
}
|
|
77
77
|
/** The `listVariants()` page, with how the words were read beside it. */
|
|
78
78
|
export type SearchVariantsOutput = ListVariantsOutput & {
|
|
79
79
|
choices?: SearchVariantsChoice[];
|
|
@@ -30,11 +30,11 @@ export type FileInput = Blob | {
|
|
|
30
30
|
* plain-text/markdown, and images (≥1, ≤16). The server classifies each file
|
|
31
31
|
* and assigns its receipt {@link SourceMaterialReceiptFile.role}.
|
|
32
32
|
*/
|
|
33
|
-
export
|
|
33
|
+
export interface UploadSourceMaterialInput {
|
|
34
34
|
files: FileInput[];
|
|
35
|
-
}
|
|
35
|
+
}
|
|
36
36
|
/** One stored file in an upload receipt. */
|
|
37
|
-
export
|
|
37
|
+
export interface SourceMaterialReceiptFile {
|
|
38
38
|
/** The stored file id (`smf_…`). Opaque — the prefix is a reading aid, not a contract. */
|
|
39
39
|
sourceId: SourceFileId;
|
|
40
40
|
/**
|
|
@@ -50,10 +50,10 @@ export type SourceMaterialReceiptFile = {
|
|
|
50
50
|
bytes: number;
|
|
51
51
|
/** PDF page count; null for images. */
|
|
52
52
|
pages: number | null;
|
|
53
|
-
}
|
|
53
|
+
}
|
|
54
54
|
/** The `201` receipt from `POST /api/v1/source-material`. */
|
|
55
|
-
export
|
|
55
|
+
export interface SourceMaterialBatchReceipt {
|
|
56
56
|
/** The stored batch id (`smb_…`). Opaque. */
|
|
57
57
|
batchId: BatchId;
|
|
58
58
|
sources: SourceMaterialReceiptFile[];
|
|
59
|
-
}
|
|
59
|
+
}
|
package/source-material.js
CHANGED
|
@@ -4,34 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { MaterialGraphError } from "./errors.js";
|
|
6
6
|
import { findSdkOperation, operationPath } from "./operations.js";
|
|
7
|
-
|
|
8
|
-
source !== null &&
|
|
9
|
-
"sourceId" in source &&
|
|
10
|
-
typeof source.sourceId === "string" &&
|
|
11
|
-
"role" in source &&
|
|
12
|
-
typeof source.role === "string" &&
|
|
13
|
-
"filename" in source &&
|
|
14
|
-
typeof source.filename === "string" &&
|
|
15
|
-
"mediaType" in source &&
|
|
16
|
-
typeof source.mediaType === "string";
|
|
17
|
-
const hasSourceMeasurements = (source) => typeof source === "object" &&
|
|
18
|
-
source !== null &&
|
|
19
|
-
"sha256" in source &&
|
|
20
|
-
typeof source.sha256 === "string" &&
|
|
21
|
-
"bytes" in source &&
|
|
22
|
-
typeof source.bytes === "number" &&
|
|
23
|
-
"pages" in source &&
|
|
24
|
-
(source.pages === null || typeof source.pages === "number");
|
|
25
|
-
const isSourceReceipt = (value) => typeof value === "object" &&
|
|
26
|
-
value !== null &&
|
|
27
|
-
"batchId" in value &&
|
|
28
|
-
typeof value.batchId === "string" &&
|
|
29
|
-
"sources" in value &&
|
|
30
|
-
Array.isArray(value.sources) &&
|
|
31
|
-
value.sources.every((source) => typeof source === "object" &&
|
|
32
|
-
source !== null &&
|
|
33
|
-
hasSourceIdentity(source) &&
|
|
34
|
-
hasSourceMeasurements(source));
|
|
7
|
+
import { parseOperationResponse } from "./parse-operation-response.js";
|
|
35
8
|
const sdkOperation = (operationId) => {
|
|
36
9
|
const match = findSdkOperation(operationId);
|
|
37
10
|
if (!match) {
|
|
@@ -85,8 +58,5 @@ export const uploadSourceMaterial = async (transport, input, signal) => {
|
|
|
85
58
|
signal,
|
|
86
59
|
url,
|
|
87
60
|
});
|
|
88
|
-
|
|
89
|
-
throw MaterialGraphError.unexpected("MaterialGraph source-material upload returned an invalid receipt");
|
|
90
|
-
}
|
|
91
|
-
return parsed;
|
|
61
|
+
return await parseOperationResponse("upload_source_material", parsed);
|
|
92
62
|
};
|
package/types.d.ts
CHANGED
|
@@ -29,13 +29,13 @@ import type { SearchCatalogSubset } from "./search-catalog-subset-types.js";
|
|
|
29
29
|
export type OpenEnum<T extends string> = T | (string & Record<never, never>);
|
|
30
30
|
export type { JsonValue } from "./json-value-types.js";
|
|
31
31
|
/** OKLab triple. */
|
|
32
|
-
export
|
|
32
|
+
export interface OklabTriple {
|
|
33
33
|
l: number;
|
|
34
34
|
a: number;
|
|
35
35
|
b: number;
|
|
36
|
-
}
|
|
36
|
+
}
|
|
37
37
|
/** The material's dominant-color block (tile/detail projections). */
|
|
38
|
-
export
|
|
38
|
+
export interface MaterialColor {
|
|
39
39
|
dominantHex: string | null;
|
|
40
40
|
hsl: {
|
|
41
41
|
h: number;
|
|
@@ -45,25 +45,23 @@ export type MaterialColor = {
|
|
|
45
45
|
oklab: OklabTriple | null;
|
|
46
46
|
chroma: number | null;
|
|
47
47
|
vibrancy: number | null;
|
|
48
|
-
}
|
|
48
|
+
}
|
|
49
49
|
/** Where the served image came from. */
|
|
50
50
|
export type ImageSource = OpenEnum<"r2" | "origin">;
|
|
51
51
|
export type { MaterialAvailability, MaterialTile } from "./material-types.js";
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
};
|
|
63
|
-
export type ProjectTypeShare = {
|
|
52
|
+
/** How much a companion is itself sampled; never a count. */
|
|
53
|
+
export interface CompanionDemand {
|
|
54
|
+
/** Share of its category's variants sampled as much or less, 1 to 100. */
|
|
55
|
+
samplePercentile: number;
|
|
56
|
+
/** Null when the year before cannot be shown. */
|
|
57
|
+
trend: OpenEnum<"rising" | "steady" | "falling"> | null;
|
|
58
|
+
/** This year against the year before; 0.4 is 40% more. Null with `trend`. */
|
|
59
|
+
change: number | null;
|
|
60
|
+
}
|
|
61
|
+
export interface ProjectTypeShare {
|
|
64
62
|
projectType: string;
|
|
65
63
|
projectCount: number;
|
|
66
|
-
}
|
|
64
|
+
}
|
|
67
65
|
/**
|
|
68
66
|
* A pairing item from the behavioral arm — real order evidence, or board
|
|
69
67
|
* curation when this seed has no order edges.
|
|
@@ -80,7 +78,7 @@ export type ProjectTypeShare = {
|
|
|
80
78
|
*
|
|
81
79
|
* See {@link ColorPairing} for the third, non-evidential arm.
|
|
82
80
|
*/
|
|
83
|
-
export
|
|
81
|
+
export interface CospecPairing {
|
|
84
82
|
/** The evidence tier. `cospec` = orders; `considered` = boards. Read it before phrasing. */
|
|
85
83
|
source: "cospec" | "considered";
|
|
86
84
|
/**
|
|
@@ -124,7 +122,7 @@ export type CospecPairing = {
|
|
|
124
122
|
topProjectTypes: ProjectTypeShare[];
|
|
125
123
|
/** Graph-owned color ranking facts, present only for an explicitly ordered rail. */
|
|
126
124
|
ranking?: PairingRanking;
|
|
127
|
-
}
|
|
125
|
+
}
|
|
128
126
|
/**
|
|
129
127
|
* A pairing item topped up from color palette-similarity — a LOOK-ALIKE, not
|
|
130
128
|
* evidence. Nobody ordered these together and nobody boarded them together; the
|
|
@@ -144,14 +142,14 @@ export type ColorPairing = {
|
|
|
144
142
|
ranking?: PairingRanking;
|
|
145
143
|
} & MaterialTile;
|
|
146
144
|
export type PairingOrderMode = "relevance" | "lightness_asc" | "lightness_desc";
|
|
147
|
-
export
|
|
145
|
+
export interface PairingRanking {
|
|
148
146
|
anchorColorSimilarity: number | null;
|
|
149
147
|
lightness: number | null;
|
|
150
148
|
anchorColorSimilarityMeasurable: boolean;
|
|
151
149
|
lightnessMeasurable: boolean;
|
|
152
150
|
basis: OpenEnum<"dominant_color_oklab">;
|
|
153
|
-
}
|
|
154
|
-
export
|
|
151
|
+
}
|
|
152
|
+
export interface PairingOrdering {
|
|
155
153
|
requested: OpenEnum<PairingOrderMode>;
|
|
156
154
|
applied: OpenEnum<PairingOrderMode>;
|
|
157
155
|
direction: OpenEnum<"ascending" | "descending">;
|
|
@@ -163,14 +161,14 @@ export type PairingOrdering = {
|
|
|
163
161
|
};
|
|
164
162
|
missingValues: OpenEnum<"last">;
|
|
165
163
|
tieBreak: OpenEnum<"variantId_asc">;
|
|
166
|
-
}
|
|
164
|
+
}
|
|
167
165
|
/**
|
|
168
166
|
* One pairing, discriminated by `source` into three tiers of very different
|
|
169
167
|
* strength: `cospec` (real orders) > `considered` (board activity) > `color`
|
|
170
168
|
* (palette look-alike). Branch on `source` before you write a sentence about it.
|
|
171
169
|
*/
|
|
172
170
|
export type PairingItem = CospecPairing | ColorPairing;
|
|
173
|
-
export
|
|
171
|
+
export interface PairingsResponse {
|
|
174
172
|
seed: MaterialTile;
|
|
175
173
|
/** A rail, not a ranked corpus — mixed evidence tiers, capped by `limit`. */
|
|
176
174
|
items: PairingItem[];
|
|
@@ -191,7 +189,7 @@ export type PairingsResponse = {
|
|
|
191
189
|
ordering?: PairingOrdering;
|
|
192
190
|
/** Opaque continuation bound to the seed, filters, corpus, and order. */
|
|
193
191
|
nextCursor?: Cursor;
|
|
194
|
-
}
|
|
192
|
+
}
|
|
195
193
|
/**
|
|
196
194
|
* How a {@link AttributeListItem} matched the query. Declared here rather than
|
|
197
195
|
* imported: this package is published, so it may not reach across into
|
|
@@ -199,7 +197,7 @@ export type PairingsResponse = {
|
|
|
199
197
|
* of truth this wire type tracks. `method` is deliberately open - a server
|
|
200
198
|
* that grows a method must not break an older client.
|
|
201
199
|
*/
|
|
202
|
-
export
|
|
200
|
+
export interface AttributeMatch {
|
|
203
201
|
method: OpenEnum<"exact" | "alias" | "fuzzy" | "vector">;
|
|
204
202
|
/** The id, name or alias that matched, or null for a match by meaning. */
|
|
205
203
|
matchedText: string | null;
|
|
@@ -212,9 +210,9 @@ export type AttributeMatch = {
|
|
|
212
210
|
* when the attribute was found through one of its values.
|
|
213
211
|
*/
|
|
214
212
|
valueId?: string;
|
|
215
|
-
}
|
|
213
|
+
}
|
|
216
214
|
/** One attribute definition on a `listAttributes()` page. */
|
|
217
|
-
export
|
|
215
|
+
export interface AttributeListItem {
|
|
218
216
|
id: string;
|
|
219
217
|
name: string;
|
|
220
218
|
description: string;
|
|
@@ -230,14 +228,14 @@ export type AttributeListItem = {
|
|
|
230
228
|
match?: AttributeMatch;
|
|
231
229
|
/** Live variants in the requested categories stating it; absent without `categoryIds`. */
|
|
232
230
|
statedBy?: number;
|
|
233
|
-
}
|
|
231
|
+
}
|
|
234
232
|
/** An attribute a block-scoped `listAttributes()` query missed, named with its real blocks. */
|
|
235
|
-
export
|
|
233
|
+
export interface OutsideScopeAttribute {
|
|
236
234
|
id: string;
|
|
237
235
|
name: string;
|
|
238
236
|
blockIds: string[];
|
|
239
|
-
}
|
|
240
|
-
export
|
|
237
|
+
}
|
|
238
|
+
export interface ListAttributesResult {
|
|
241
239
|
items: AttributeListItem[];
|
|
242
240
|
/** Page one only: matches outside `blockIds` ranking above the best item. Absent when the check did not apply. */
|
|
243
241
|
outsideScope?: OutsideScopeAttribute[];
|
|
@@ -247,16 +245,16 @@ export type ListAttributesResult = {
|
|
|
247
245
|
endCursor: string | null;
|
|
248
246
|
hasNextPage: boolean;
|
|
249
247
|
};
|
|
250
|
-
}
|
|
248
|
+
}
|
|
251
249
|
export type { ResolveValueCandidate, ValueResolution, } from "./catalog-discovery-types.js";
|
|
252
250
|
export type { ResolveColorOptions, ResolveColorCatalogVariant, ResolveColorVariant, ResolveColorResponse, } from "./resolve-color-types.js";
|
|
253
251
|
export type { BySpecVerdictState, BySpecVerdictCell, BySpecVerdict, MaterialVerdict, BySpecUnresolvedCriterion, } from "./by-spec-types.js";
|
|
254
|
-
export
|
|
252
|
+
export interface WhoamiResponse {
|
|
255
253
|
principal: string;
|
|
256
254
|
scopes: string[];
|
|
257
|
-
}
|
|
255
|
+
}
|
|
258
256
|
/** Options for a pairings read. */
|
|
259
|
-
export
|
|
257
|
+
export interface PairingsOptions {
|
|
260
258
|
/** Comma-separated coarse category display names; filters both arms. */
|
|
261
259
|
categories?: string;
|
|
262
260
|
/** Page size, 1–24 inclusive (default 12). The server rejects (400), not clamps, values outside this range. */
|
|
@@ -269,9 +267,9 @@ export type PairingsOptions = {
|
|
|
269
267
|
searchCatalogSubset?: SearchCatalogSubset;
|
|
270
268
|
/** The previous response's `nextCursor`, passed back verbatim. */
|
|
271
269
|
cursor?: Cursor;
|
|
272
|
-
}
|
|
270
|
+
}
|
|
273
271
|
/** Options for `listAttributes()` (GET `/api/v1/catalog/attributes`). */
|
|
274
|
-
export
|
|
272
|
+
export interface ListAttributesOptions {
|
|
275
273
|
/** An attribute id, name, misspelling or meaning, e.g. "reduces echo". */
|
|
276
274
|
query?: string;
|
|
277
275
|
/** Keep attributes in any of these blocks. */
|
|
@@ -284,8 +282,8 @@ export type ListAttributesOptions = {
|
|
|
284
282
|
limit?: number;
|
|
285
283
|
/** `pageInfo.endCursor` from the previous page, with the same query and scope. */
|
|
286
284
|
cursor?: string;
|
|
287
|
-
}
|
|
288
|
-
export
|
|
285
|
+
}
|
|
286
|
+
export interface ExtractedPalette {
|
|
289
287
|
colors: {
|
|
290
288
|
hex: string;
|
|
291
289
|
name: string;
|
|
@@ -298,14 +296,14 @@ export type ExtractedPalette = {
|
|
|
298
296
|
oklch: string;
|
|
299
297
|
} | null;
|
|
300
298
|
mood: string;
|
|
301
|
-
}
|
|
302
|
-
export
|
|
299
|
+
}
|
|
300
|
+
export interface ExtractPaletteResponse {
|
|
303
301
|
palette: ExtractedPalette | null;
|
|
304
|
-
}
|
|
302
|
+
}
|
|
305
303
|
/** Body for `POST /api/v1/search/palettes/extract`. */
|
|
306
|
-
export
|
|
304
|
+
export interface ExtractPaletteInput {
|
|
307
305
|
/** The query image as a data URI or bare base64 string. */
|
|
308
306
|
image: string;
|
|
309
307
|
/** Max palette swatches to return (default 6). */
|
|
310
308
|
max?: number;
|
|
311
|
-
}
|
|
309
|
+
}
|
package/webmcp.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
+
/** A JSON value, as a tool's input and output schemas are written. */
|
|
2
|
+
export type WebMcpJson = string | number | boolean | null | readonly WebMcpJson[] | WebMcpJsonObject;
|
|
3
|
+
/** A JSON object whose every member is a JSON value. */
|
|
4
|
+
export interface WebMcpJsonObject {
|
|
5
|
+
readonly [key: string]: WebMcpJson;
|
|
6
|
+
}
|
|
1
7
|
/** Canonical operation contracts. Consumers validate both boundaries and supply their own transport. */
|
|
2
|
-
export
|
|
8
|
+
export interface WebMcpToolContract {
|
|
3
9
|
readonly name: "search";
|
|
4
10
|
readonly operationId: string;
|
|
5
11
|
readonly path: string;
|
|
6
12
|
readonly method: "POST";
|
|
7
13
|
readonly description: string;
|
|
8
|
-
readonly inputSchema:
|
|
9
|
-
readonly outputSchema:
|
|
14
|
+
readonly inputSchema: WebMcpJsonObject;
|
|
15
|
+
readonly outputSchema: WebMcpJsonObject;
|
|
10
16
|
readonly annotations: {
|
|
11
17
|
readonly readOnlyHint: boolean;
|
|
12
18
|
readonly untrustedContentHint: boolean;
|
|
13
19
|
};
|
|
14
20
|
readonly requiresVisibleConfirmation: boolean;
|
|
15
21
|
readonly requiredHeaders: readonly string[];
|
|
16
|
-
}
|
|
22
|
+
}
|
|
17
23
|
export { WEBMCP_TOOLS } from "./webmcp.generated.js";
|