@instruments/materialgraph 0.35.0 → 0.37.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-spec-types.d.ts +0 -2
- package/client.d.ts +7 -9
- package/client.js +7 -10
- package/{find-companions-types.d.ts → find-sampled-together-types.d.ts} +17 -17
- package/find-sampled-together-types.js +12 -0
- package/find-variants-by-color-types.d.ts +2 -2
- package/find-variants-by-vector-types.d.ts +2 -2
- package/get-variant-types.d.ts +2 -2
- package/get-variant-types.js +2 -2
- package/image-reference-types.d.ts +1 -1
- package/index.d.ts +1 -2
- package/list-enum-values-types.d.ts +2 -2
- package/list-variant-facets-types.d.ts +2 -2
- package/list-variants-types.d.ts +3 -3
- package/list-variants-types.js +3 -3
- package/operations.d.ts +1 -1
- package/operations.js +6 -2
- package/package.json +1 -1
- package/resolve-variant-types.d.ts +1 -1
- package/resolve-variant-types.js +1 -1
- package/response-schemas.generated.d.ts +1 -1
- package/response-schemas.generated.js +25 -26
- package/search-variants-types.d.ts +6 -4
- package/types.d.ts +3 -3
- package/webmcp.generated.js +4 -4
- package/citation-types.d.ts +0 -34
- package/citation-types.js +0 -1
- package/find-companions-types.js +0 -12
- package/ndjson.d.ts +0 -46
- package/ndjson.js +0 -111
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* @module search-variants-types
|
|
3
3
|
* @description Hand-maintained mirror of `search_variants`'s (MG-2223) input
|
|
4
4
|
* and output wire shapes. The source of truth is
|
|
5
|
-
* `packages/
|
|
5
|
+
* `packages/search/src/search-variants/search-variants.ts` and
|
|
6
6
|
* `compose-conditions.ts`; this SDK has no runtime dependency on
|
|
7
|
-
* `@materialgraph/
|
|
7
|
+
* `@materialgraph/search`, so the shapes are copied here and
|
|
8
8
|
* `contract-parity.test.ts` keeps them honest.
|
|
9
9
|
*/
|
|
10
10
|
import type { ColorRangeCondition, FilterGroups, ListVariantsInclude, ListVariantsOutput, OptionalFilterGroups } from "./list-variants-types.js";
|
|
@@ -22,6 +22,8 @@ export type SearchVariantsInput = {
|
|
|
22
22
|
cursor?: string;
|
|
23
23
|
/** Optional per-item fields, as `listVariants()` takes; `image` adds each row's image. */
|
|
24
24
|
include?: ListVariantsInclude[];
|
|
25
|
+
/** Up to eight `understood` texts whose conditions to drop; their words are then unresolved. A text that names no understood condition is refused. */
|
|
26
|
+
leaveOut?: string[];
|
|
25
27
|
/** 1–50; defaults to 10. */
|
|
26
28
|
limit?: number;
|
|
27
29
|
/** What to find, in plain words. 1–200 characters. */
|
|
@@ -80,8 +82,8 @@ export type SearchVariantsOutput = ListVariantsOutput & {
|
|
|
80
82
|
oneRowPer: "product" | "variant";
|
|
81
83
|
/** The `listVariants()` preferences that ran. */
|
|
82
84
|
optionalFilters?: OptionalFilterGroups;
|
|
83
|
-
/** How the search ended. */
|
|
84
|
-
outcome: "page" | "no_match" | "nothing_understood" | "out_of_scope" | "brand_not_in_catalogue";
|
|
85
|
+
/** How the search ended. `partial_match`: no variant met every condition together, so those read from words (never a category, brand or number) rank instead of filtering; `understood` says which. */
|
|
86
|
+
outcome: "page" | "partial_match" | "no_match" | "nothing_understood" | "out_of_scope" | "brand_not_in_catalogue";
|
|
85
87
|
/** The fixed search scope, also present in `filters`. */
|
|
86
88
|
scope?: FilterGroups;
|
|
87
89
|
/** One entry per phrase the parser read, in the parser's order. */
|
package/types.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ export type CospecPairing = {
|
|
|
102
102
|
* How this companion relates to the seed — the distinction raw order evidence
|
|
103
103
|
* does not carry, and the one that decides what you may claim.
|
|
104
104
|
*
|
|
105
|
-
* - `
|
|
105
|
+
* - `other_brand` — a DIFFERENT BRAND entirely. This is the cross-brand claim
|
|
106
106
|
* the rail exists to make.
|
|
107
107
|
* - `brand_sibling` — the seed's own brand, a different product.
|
|
108
108
|
* - `colorway` — the seed's own product, restyled.
|
|
@@ -113,7 +113,7 @@ export type CospecPairing = {
|
|
|
113
113
|
* Optional because responses captured before the field existed are genuinely
|
|
114
114
|
* in the wild; absent means "from an older version", never "unrelated".
|
|
115
115
|
*/
|
|
116
|
-
relation?: "
|
|
116
|
+
relation?: "other_brand" | "brand_sibling" | "colorway";
|
|
117
117
|
category: string | null;
|
|
118
118
|
projectCount: number;
|
|
119
119
|
customerCount: number;
|
|
@@ -194,7 +194,7 @@ export type PairingsResponse = {
|
|
|
194
194
|
/**
|
|
195
195
|
* How a {@link AttributeListItem} matched the query. Declared here rather than
|
|
196
196
|
* imported: this package is published, so it may not reach across into
|
|
197
|
-
* `@materialgraph/
|
|
197
|
+
* `@materialgraph/search`, whose `listAttributesResultSchema` is the source
|
|
198
198
|
* of truth this wire type tracks. `method` is deliberately open - a server
|
|
199
199
|
* that grows a method must not break an older client.
|
|
200
200
|
*/
|
package/webmcp.generated.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const json = [
|
|
2
|
-
"[{\"annotations\":{\"readOnlyHint\":true,\"untrustedContentHint\":true},\"description\":\"Reads `query` into filters, runs them through `list_variants` and answers with what was understood beside a page of variants. `understood` says what each phrase became: a hard `filter`, a ranking `preference`, or `not_applied` when nothing could serve it. `filters`, `optionalFilters` and `name` are exactly what ran, so the three can be sent to `list_variants` to narrow or widen the same search. A phrase with more than one meaning is answered with one and listed in `choices`: send its `handle` with an alternative's `group` and `id` in `selections` to switch it. `unresolved` lists words nothing in the vocabulary could read. A query that applies nothing returns no items, never the whole catalogue; a preference alone still ranks it. `cursor` is the previous page's `pageInfo.endCursor`, tied to the vocabulary version the query was read against; it pages this operation only, not `list_variants`. Requires the `mg:read` bearer scope.\",\"inputSchema\":{\"$ref\":\"#/$defs/schema0\",\"$defs\":{\"schema0\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"description\":\"Attribute/block ids to add; id fields always return.\",\"maxItems\":20,\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"cursor\":{\"type\":\"string\"},\"limit\":{\"description\":\"5-10 for examples.\",\"type\":\"integer\",\"minimum\":1,\"maximum\":50},\"query\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":200,\"description\":\"What to find, in plain words.\"},\"selections\":{\"description\":\"Switch a choice:
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
2
|
+
"[{\"annotations\":{\"readOnlyHint\":true,\"untrustedContentHint\":true},\"description\":\"Reads `query` into filters, runs them through `list_variants` and answers with what was understood beside a page of variants. `understood` says what each phrase became: a hard `filter`, a ranking `preference`, or `not_applied` when nothing could serve it. `filters`, `optionalFilters` and `name` are exactly what ran, so the three can be sent to `list_variants` to narrow or widen the same search. A phrase with more than one meaning is answered with one and listed in `choices`: send its `handle` with an alternative's `group` and `id` in `selections` to switch it. `unresolved` lists words nothing in the vocabulary could read. A query that applies nothing returns no items, never the whole catalogue; a preference alone still ranks it. `cursor` is the previous page's `pageInfo.endCursor`, tied to the vocabulary version the query was read against; it pages this operation only, not `list_variants`. Requires the `mg:read` bearer scope.\",\"inputSchema\":{\"$ref\":\"#/$defs/schema0\",\"$defs\":{\"schema0\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"description\":\"Attribute/block ids to add; id fields always return.\",\"maxItems\":20,\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"cursor\":{\"type\":\"string\"},\"leaveOut\":{\"maxItems\":8,\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"limit\":{\"description\":\"5-10 for examples.\",\"type\":\"integer\",\"minimum\":1,\"maximum\":50},\"query\":{\"type\":\"string\",\"minLength\":1,\"maxLength\":200,\"description\":\"What to find, in plain words.\"},\"selections\":{\"description\":\"Switch a choice: handle, alternative group and id.\",\"maxItems\":8,\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"group\":{\"type\":\"string\"},\"handle\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"}},\"required\":[\"group\",\"handle\",\"id\"],\"additionalProperties\":false}},\"searchCatalogueSubset\":{\"description\":\"Only this corpus scope. Absent or all: every variant.\",\"type\":\"string\",\"enum\":[\"all\",\"samplizeCatalogue\",\"materialBankOrderable\",\"materialBankNaOrderable\",\"materialBankNaAndCatalogue\",\"materialBankEuOrderable\",\"designShopOrderable\"]},\"include\":{\"type\":\"array\",\"items\":{\"type\":\"string\",\"enum\":[\"image\",\"url\"]}}},\"required\":[\"query\"],\"additionalProperties\":false}}},\"method\":\"POST\",\"name\":\"search\",\"operationId\":\"search_variants\",\"outputSchema\":{\"$ref\":\"#/$defs/schema0\",\"$defs\":{\"schema1\":{\"anyOf\":[{\"type\":\"string\"},{\"type\":\"number\"},{\"type\":\"boolean\"},{\"type\":\"null\"},{\"type\":\"array\",\"items\":{\"$ref\":\"#/$defs/schema1\"}},{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"$ref\":\"#/$defs/schema1\"}}]},\"schema0\":{\"type\":\"object\",\"properties\":{\"excludedBySearchCatalogueSubset\":{\"description\":\"Filtered variant ids outside the materials catalogue.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"items\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"category\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},{\"type\":\"null\"}],\"description\":\"The first original source category, or null when unknown.\"},\"categories\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},\"description\":\"All original source categories in source order.\"},\"productType\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},{\"type\":\"null\"}],\"description\":\"The accepted primary specification type, or null for a color sample or unresolved subject.\"},\"sampleSubject\":{\"type\":\"string\",\"enum\":[\"material\",\"paint_color_sample\",\"unknown\",\"conflict\"]},\"colorOptionValueId\":{\"type\":[\"string\",\"null\"]},\"code\":{\"description\":\"The brand's item code.\",\"type\":[\"string\",\"null\"]},\"image\":{\"anyOf\":[{\"type\":\"object\",\"properties\":{\"alt\":{\"type\":\"string\"},\"url\":{\"type\":\"string\"}},\"required\":[\"alt\",\"url\"],\"additionalProperties\":false},{\"type\":\"null\"}],\"description\":\"The primary product image, or null when there is none.\"},\"brand\":{\"type\":\"object\",\"p",
|
|
3
|
+
"roperties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false,\"description\":\"The brand. `id` is the slug get_brand takes.\"},\"name\":{\"type\":\"string\",\"description\":\"The variant's own name.\"},\"product\":{\"type\":\"object\",\"properties\":{\"id\":{\"type\":\"string\"},\"name\":{\"type\":\"string\"}},\"required\":[\"id\",\"name\"],\"additionalProperties\":false},\"url\":{\"description\":\"The brand's page for it, or null when none is known.\",\"type\":[\"string\",\"null\"]},\"variantId\":{\"type\":\"string\"},\"materialBankId\":{\"description\":\"The variant's Material Bank SKU. Absent: none recorded.\",\"type\":\"string\"},\"notApplicable\":{\"type\":\"object\",\"properties\":{\"attributes\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"blocks\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"additionalProperties\":false,\"description\":\"Requested blocks or attributes this product type does not carry.\"},\"preference\":{\"type\":\"object\",\"properties\":{\"matched\":{\"type\":\"array\",\"items\":{\"type\":\"number\"}},\"score\":{\"type\":\"number\"}},\"required\":[\"matched\",\"score\"],\"additionalProperties\":false},\"specifications\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"type\":\"object\",\"propertyNames\":{\"type\":\"string\"},\"additionalProperties\":{\"$ref\":\"#/$defs/schema1\"}}},\"variantCount\":{\"description\":\"Eligible variants of this product. Absent: none counted.\",\"type\":\"integer\",\"exclusiveMinimum\":0,\"maximum\":9007199254740991}},\"required\":[\"category\",\"categories\",\"productType\",\"sampleSubject\",\"colorOptionValueId\",\"code\",\"brand\",\"name\",\"product\",\"variantId\"],\"additionalProperties\":false}},\"pageInfo\":{\"type\":\"object\",\"properties\":{\"endCursor\":{\"type\":[\"string\",\"null\"]},\"hasNextPage\":{\"type\":\"boolean\"}},\"required\":[\"endCursor\",\"hasNextPage\"],\"additionalProperties\":false},\"preferenceMatchesRemain\":{\"description\":\"False: nothing from this page on meets any optionalFilter.\",\"type\":\"boolean\"},\"unavailableVariantIds\":{\"description\":\"Filtered ids in the catalogue this list can't show, e.g. retired.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"unresolvedVariantIds\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"unstated\":{\"description\":\"Filtered attributes no variant in scope states at all.\",\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"words\":{\"description\":\"Each word asked for, and whether any variant in scope names it.\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"matched\":{\"type\":\"boolean\"},\"word\":{\"type\":\"string\"}},\"required\":[\"matched\",\"word\"],\"additionalProperties\":false}},\"choices\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"alternatives\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"group\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"kind\":{\"type\":\"string\"},\"label\":{\"type\":\"string\"}},\"required\":[\"group\",\"id\",\"kind\",\"label\"],\"additionalProperties\":false}},\"basis\":{\"type\":\"string\"},\"handle\":{\"type\":\"string\"},\"reason\":{\"type\":\"string\"},\"selected\":{\"type\":\"object\",\"properties\":{\"group\":{\"type\":\"string\"},\"id\":{\"type\":\"string\"},\"kind\":{\"type\":\"string\"},\"label\":{\"type\":\"string\"}},\"required\":[\"group\",\"id\",\"kind\",\"label\"],\"additionalProperties\":false},\"text\":{\"type\":\"string\"}},\"required\":[\"alternatives\",\"basis\",\"handle\",\"reason\",\"selected\",\"text\"],\"additionalProperties\":false}},\"colors\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"hex\":{\"type\":\"string\",\"pattern\":\"^#[\\\\da-f]{6}$\",\"description\":\"The color's own point in the region; it orders matches.\"},\"intent\":{\"type\":\"string\",\"enum\":[\"required\",\"preferred\"]},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"range\":{\"type\":\"object\",\"properties\":{\"chroma\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},\"hue\":{\"anyOf\":[{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2},{\"type\":\"null\"}]},\"lightness\":{\"type\":\"array\",\"prefixItems\":[{\"type\":\"number\"},{\"type\":\"number\"}],\"items\":false,\"minItems\":2,\"maxItems\":2}},\"required\":[\"chroma\",\"hue\",\"lightness\"],\"additionalProperties\":false}},\"required\":[\"hex\",\"op\",\"range\"],\"additionalProperties\":false},\"description\":\"The color",
|
|
4
|
+
" regions that ran.\"},\"corrections\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"correction\":{\"type\":\"string\"},\"word\":{\"type\":\"string\"}},\"required\":[\"correction\",\"word\"],\"additionalProperties\":false}},\"filters\":{\"type\":\"object\",\"properties\":{\"anyField\":{\"description\":\"One of values in any of fields (term attributes).\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"fields\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"fields\",\"op\",\"values\"],\"additionalProperties\":false}},\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]},\"value\":{\"type\":\"number\"}},\"required\":[\"field\",\"op\",\"value\"],\"additionalProperties\":false}},\"presence\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"exists\",\"missing\"]}},\"required\":[\"field\",\"op\"],\"additionalProperties\":false}},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"all\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"field\",\"op\",\"values\"],\"additionalProperties\":false}}},\"additionalProperties\":false,\"description\":\"The filters that ran, the scope among them.\"},\"name\":{\"type\":\"string\",\"description\":\"The paint name looked up.\"},\"oneRowPer\":{\"type\":\"string\",\"enum\":[\"product\",\"variant\"],\"description\":\"A row per product, or per variant for a paint or color.\"},\"optionalFilters\":{\"type\":\"object\",\"properties\":{\"anyField\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"fields\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"fields\",\"op\",\"values\",\"weight\"],\"additionalProperties\":false}},\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]},\"value\":{\"type\":\"number\"},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"field\",\"op\",\"value\",\"weight\"],\"additionalProperties\":false}},\"presence\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"exists\",\"missing\"]},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"field\",\"op\",\"weight\"],\"additionalProperties\":false}},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"all\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"weight\":{\"type\":\"integer\",\"minimum\":1,\"maximum\":10}},\"required\":[\"field\",\"op\",\"values\",\"weight\"],\"additionalProperties\":false}}},\"additionalProperties\":false,\"description\":\"The preferences that ran.\"},\"outcome\":{\"type\":\"string\",\"enum\":[\"page\",\"partial_match\",\"no_match\",\"nothing_understood\",\"out_of_scope\",\"brand_not_in_catalogue\"],\"description\":\"How the search ended.\"},\"scope\":{\"type\":\"object\",\"properties\":{\"anyField\":{\"description\":\"One of values in any of fields (term attributes).\",\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"fields\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"fields\",\"op\",\"values\"],\"additionalProperties\":false}},\"numbers\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"eq\",\"gt\",\"gte\",\"lt\",\"lte\"]},\"value\":{\"type\":\"number\"}},\"required\":[\"field\",\"op\",\"value\"],\"additionalProperties\":false}},\"presence\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"t",
|
|
5
|
+
"ype\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"exists\",\"missing\"]}},\"required\":[\"field\",\"op\"],\"additionalProperties\":false}},\"terms\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"field\":{\"type\":\"string\"},\"op\":{\"type\":\"string\",\"enum\":[\"in\",\"all\",\"not_in\"]},\"orText\":{\"type\":\"string\"},\"unstated\":{\"type\":\"string\",\"const\":\"pass\"},\"values\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"field\",\"op\",\"values\"],\"additionalProperties\":false}}},\"additionalProperties\":false,\"description\":\"The fixed scope, repeated in filters.\"},\"understood\":{\"type\":\"array\",\"items\":{\"type\":\"object\",\"properties\":{\"applied\":{\"type\":\"string\",\"enum\":[\"filter\",\"preference\",\"not_applied\"],\"description\":\"filter narrows; preference only ranks; not_applied did neither.\"},\"id\":{\"type\":\"string\",\"description\":\"The parser's condition id.\"},\"kind\":{\"type\":\"string\",\"enum\":[\"category\",\"brand\",\"term\",\"number\",\"color\",\"paint\"]},\"label\":{\"type\":\"string\",\"description\":\"What the words were read as.\"},\"note\":{\"type\":\"string\"},\"text\":{\"type\":\"string\",\"description\":\"The query words it came from.\"}},\"required\":[\"applied\",\"id\",\"kind\",\"label\",\"text\"],\"additionalProperties\":false}},\"unresolved\":{\"type\":\"array\",\"items\":{\"type\":\"string\"}}},\"required\":[\"items\",\"pageInfo\",\"oneRowPer\",\"outcome\",\"understood\"],\"additionalProperties\":false}}},\"path\":\"/api/v1/variants/search\",\"requiredHeaders\":[],\"requiresVisibleConfirmation\":false}]",
|
|
6
6
|
].join("");
|
|
7
7
|
export const WEBMCP_TOOLS = JSON.parse(json);
|
package/citation-types.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/** Small handle carried by a verdict cell. Resolve it only when evidence is opened. */
|
|
2
|
-
export type VerdictCitation = {
|
|
3
|
-
citationId: string;
|
|
4
|
-
sourceType: string;
|
|
5
|
-
count: number;
|
|
6
|
-
};
|
|
7
|
-
export type ResolvedVerdictCitation = {
|
|
8
|
-
citationId: string;
|
|
9
|
-
sourceType: string;
|
|
10
|
-
source: {
|
|
11
|
-
kind: "source_record" | "source_material" | "source_statement" | "url" | "asset" | "download" | "manual_note" | "agent_output";
|
|
12
|
-
/** Canonical source/fact/asset/download id, a public source URL, or the claim-source handle when no public reference is available. */
|
|
13
|
-
ref: string;
|
|
14
|
-
title?: string;
|
|
15
|
-
url?: string;
|
|
16
|
-
/** Same-origin public asset proxy path when retained bytes are available. */
|
|
17
|
-
publicPath?: string;
|
|
18
|
-
sourceId?: string;
|
|
19
|
-
sourceStatementId?: string;
|
|
20
|
-
sourceAssetId?: string;
|
|
21
|
-
sourceDownloadId?: string;
|
|
22
|
-
locator?: {
|
|
23
|
-
page?: number;
|
|
24
|
-
selector?: string;
|
|
25
|
-
xPath?: string;
|
|
26
|
-
imageBox?: {
|
|
27
|
-
x: number;
|
|
28
|
-
y: number;
|
|
29
|
-
width: number;
|
|
30
|
-
height: number;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
};
|
package/citation-types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/find-companions-types.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module find-companions-types
|
|
3
|
-
* @description Hand-maintained mirror of `find_companions`' (MG-2332) input and
|
|
4
|
-
* output wire shapes. The source of truth is
|
|
5
|
-
* `packages/products/src/cospec/schema.ts` (`findCompanionsInputSchema`,
|
|
6
|
-
* `findCompanionsResultSchema`). This SDK has no RUNTIME dependency on
|
|
7
|
-
* `@materialgraph/products` (it's a devDependency only, for the parity tests in
|
|
8
|
-
* `__tests__/`), so the shapes are copied here rather than imported.
|
|
9
|
-
* `contract-parity.test.ts` keeps this mirror honest against the server types,
|
|
10
|
-
* the project-type list included.
|
|
11
|
-
*/
|
|
12
|
-
export {};
|
package/ndjson.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A minimal, dependency-free NDJSON (newline-delimited JSON) line reader — the
|
|
3
|
-
* primitive for line-oriented JSON streams. Hand-rolled so the
|
|
4
|
-
* SDK stays zero-runtime-dep and works unchanged inside Node route handlers,
|
|
5
|
-
* where `fetch` yields a byte `ReadableStream`.
|
|
6
|
-
*
|
|
7
|
-
* Deliberately a SIBLING of `sse.ts`, not a reuse of it. NDJSON and SSE agree on
|
|
8
|
-
* nothing but "text arrives in chunks": SSE frames are `field: value` lines
|
|
9
|
-
* terminated by a BLANK line, with comment lines and multi-line `data:`
|
|
10
|
-
* accumulation, whereas an NDJSON frame is exactly one line of JSON. Feeding
|
|
11
|
-
* NDJSON through the SSE tokenizer would read `{"type":"step",…}` as a field
|
|
12
|
-
* named `{"type"` and silently discard every frame. The two also want OPPOSITE
|
|
13
|
-
* end-of-stream policies: SSE dispatches a trailing partial frame as valid,
|
|
14
|
-
* while a truncated NDJSON line must surface as an error (enforced by the
|
|
15
|
-
* caller, which parses whatever `flush` returns rather than dropping it).
|
|
16
|
-
*
|
|
17
|
-
* Line endings: the reader splits on `\n` only, per the NDJSON contract. A `\r`
|
|
18
|
-
* left by a CRLF-normalising proxy stays as trailing whitespace on the line,
|
|
19
|
-
* which `JSON.parse` ignores.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* A push-based NDJSON line assembler. Feed it decoded text with {@link push};
|
|
23
|
-
* it returns the lines that text COMPLETED, terminators removed. Any partial
|
|
24
|
-
* trailing line is held in an internal buffer until a later chunk terminates it,
|
|
25
|
-
* or until {@link flush} surrenders it at end of stream.
|
|
26
|
-
*/
|
|
27
|
-
export declare class NdjsonDecoder {
|
|
28
|
-
#private;
|
|
29
|
-
/** Absorb one decoded chunk and return the lines it completed, in order. */
|
|
30
|
-
push(text: string): string[];
|
|
31
|
-
/**
|
|
32
|
-
* Surrender the unterminated remainder at end of stream — a well-formed
|
|
33
|
-
* NDJSON stream's final line need not carry a trailing newline. The remainder
|
|
34
|
-
* is RETURNED, never dropped: a truncated frame is the caller's error to
|
|
35
|
-
* raise, not this decoder's fragment to discard.
|
|
36
|
-
*/
|
|
37
|
-
flush(): string[];
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Iterate the NDJSON lines of a byte stream. Only lines with non-whitespace
|
|
41
|
-
* content are yielded — a blank separator line carries no frame and must never
|
|
42
|
-
* reach `JSON.parse`, where it would become an empty object. Stops cleanly when
|
|
43
|
-
* the stream ends or `signal` aborts (mid-read abort rejections are swallowed
|
|
44
|
-
* once the signal is set).
|
|
45
|
-
*/
|
|
46
|
-
export declare function readNdjsonLines(body: ReadableStream<Uint8Array>, signal?: AbortSignal): AsyncGenerator<string, void, unknown>;
|
package/ndjson.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A minimal, dependency-free NDJSON (newline-delimited JSON) line reader — the
|
|
3
|
-
* primitive for line-oriented JSON streams. Hand-rolled so the
|
|
4
|
-
* SDK stays zero-runtime-dep and works unchanged inside Node route handlers,
|
|
5
|
-
* where `fetch` yields a byte `ReadableStream`.
|
|
6
|
-
*
|
|
7
|
-
* Deliberately a SIBLING of `sse.ts`, not a reuse of it. NDJSON and SSE agree on
|
|
8
|
-
* nothing but "text arrives in chunks": SSE frames are `field: value` lines
|
|
9
|
-
* terminated by a BLANK line, with comment lines and multi-line `data:`
|
|
10
|
-
* accumulation, whereas an NDJSON frame is exactly one line of JSON. Feeding
|
|
11
|
-
* NDJSON through the SSE tokenizer would read `{"type":"step",…}` as a field
|
|
12
|
-
* named `{"type"` and silently discard every frame. The two also want OPPOSITE
|
|
13
|
-
* end-of-stream policies: SSE dispatches a trailing partial frame as valid,
|
|
14
|
-
* while a truncated NDJSON line must surface as an error (enforced by the
|
|
15
|
-
* caller, which parses whatever `flush` returns rather than dropping it).
|
|
16
|
-
*
|
|
17
|
-
* Line endings: the reader splits on `\n` only, per the NDJSON contract. A `\r`
|
|
18
|
-
* left by a CRLF-normalising proxy stays as trailing whitespace on the line,
|
|
19
|
-
* which `JSON.parse` ignores.
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* A push-based NDJSON line assembler. Feed it decoded text with {@link push};
|
|
23
|
-
* it returns the lines that text COMPLETED, terminators removed. Any partial
|
|
24
|
-
* trailing line is held in an internal buffer until a later chunk terminates it,
|
|
25
|
-
* or until {@link flush} surrenders it at end of stream.
|
|
26
|
-
*/
|
|
27
|
-
export class NdjsonDecoder {
|
|
28
|
-
#buffer = "";
|
|
29
|
-
/** Absorb one decoded chunk and return the lines it completed, in order. */
|
|
30
|
-
push(text) {
|
|
31
|
-
this.#buffer += text;
|
|
32
|
-
const lines = [];
|
|
33
|
-
for (;;) {
|
|
34
|
-
const index = this.#buffer.indexOf("\n");
|
|
35
|
-
if (index === -1) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
lines.push(this.#buffer.slice(0, index));
|
|
39
|
-
this.#buffer = this.#buffer.slice(index + 1);
|
|
40
|
-
}
|
|
41
|
-
return lines;
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Surrender the unterminated remainder at end of stream — a well-formed
|
|
45
|
-
* NDJSON stream's final line need not carry a trailing newline. The remainder
|
|
46
|
-
* is RETURNED, never dropped: a truncated frame is the caller's error to
|
|
47
|
-
* raise, not this decoder's fragment to discard.
|
|
48
|
-
*/
|
|
49
|
-
flush() {
|
|
50
|
-
if (this.#buffer.length === 0) {
|
|
51
|
-
return [];
|
|
52
|
-
}
|
|
53
|
-
const remainder = this.#buffer;
|
|
54
|
-
this.#buffer = "";
|
|
55
|
-
return [remainder];
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Iterate the NDJSON lines of a byte stream. Only lines with non-whitespace
|
|
60
|
-
* content are yielded — a blank separator line carries no frame and must never
|
|
61
|
-
* reach `JSON.parse`, where it would become an empty object. Stops cleanly when
|
|
62
|
-
* the stream ends or `signal` aborts (mid-read abort rejections are swallowed
|
|
63
|
-
* once the signal is set).
|
|
64
|
-
*/
|
|
65
|
-
export async function* readNdjsonLines(body, signal) {
|
|
66
|
-
const reader = body.getReader();
|
|
67
|
-
const decoder = new TextDecoder();
|
|
68
|
-
const ndjson = new NdjsonDecoder();
|
|
69
|
-
try {
|
|
70
|
-
for (;;) {
|
|
71
|
-
if (signal?.aborted) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
let result;
|
|
75
|
-
try {
|
|
76
|
-
result = await reader.read();
|
|
77
|
-
}
|
|
78
|
-
catch (error) {
|
|
79
|
-
if (signal?.aborted) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
if (result.done) {
|
|
85
|
-
// `decode()` with no argument flushes any dangling multi-byte sequence.
|
|
86
|
-
for (const line of ndjson.push(decoder.decode())) {
|
|
87
|
-
if (line.trim().length > 0) {
|
|
88
|
-
yield line;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
for (const line of ndjson.flush()) {
|
|
92
|
-
if (line.trim().length > 0) {
|
|
93
|
-
yield line;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
for (const line of ndjson.push(decoder.decode(result.value, { stream: true }))) {
|
|
99
|
-
if (signal?.aborted) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (line.trim().length > 0) {
|
|
103
|
-
yield line;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
finally {
|
|
109
|
-
reader.releaseLock();
|
|
110
|
-
}
|
|
111
|
-
}
|