@instruments/materialgraph 0.25.0 → 0.26.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/association-types.d.ts +20 -20
  2. package/associations-client.d.ts +4 -4
  3. package/associations-client.js +3 -10
  4. package/attribution-types.d.ts +3 -3
  5. package/brand-most-sampled-types.d.ts +4 -4
  6. package/brand-types.d.ts +6 -6
  7. package/brands-client.d.ts +4 -4
  8. package/brands-client.js +9 -13
  9. package/browse-types.d.ts +8 -8
  10. package/by-colour-types.d.ts +18 -18
  11. package/by-spec-types.d.ts +14 -14
  12. package/catalog-discovery-types.d.ts +14 -14
  13. package/catalogue-client.d.ts +4 -4
  14. package/catalogue-client.js +38 -37
  15. package/catalogue-types.d.ts +4 -4
  16. package/citation-types.d.ts +4 -4
  17. package/client-browse.d.ts +4 -4
  18. package/client-browse.js +24 -25
  19. package/client-config.d.ts +2 -2
  20. package/client-exploration.d.ts +3 -3
  21. package/client-exploration.js +4 -6
  22. package/client-source-material-comments.d.ts +4 -4
  23. package/client-source-material-comments.js +4 -38
  24. package/client-vocabulary.d.ts +8 -8
  25. package/client-vocabulary.js +20 -30
  26. package/client.d.ts +11 -45
  27. package/client.js +143 -188
  28. package/codes-client.d.ts +2 -2
  29. package/codes-client.js +8 -8
  30. package/codes-types.d.ts +34 -34
  31. package/colour-aggregate-types.d.ts +24 -24
  32. package/colours-client.d.ts +2 -2
  33. package/colours-client.js +15 -15
  34. package/compare-types.d.ts +10 -10
  35. package/composition-client.d.ts +3 -3
  36. package/composition-client.js +8 -7
  37. package/composition-types.d.ts +12 -12
  38. package/coordinate-client.d.ts +2 -2
  39. package/coordinate-client.js +1 -13
  40. package/corpus-scope-types.d.ts +3 -3
  41. package/corpus-scope-types.js +1 -25
  42. package/correction-types.d.ts +10 -10
  43. package/demand-batch-types.d.ts +18 -18
  44. package/demand-types.d.ts +24 -24
  45. package/errors.d.ts +12 -12
  46. package/errors.js +53 -52
  47. package/exploration-types.d.ts +22 -22
  48. package/fan-deck-types.d.ts +6 -6
  49. package/http-transport.d.ts +13 -21
  50. package/http-transport.js +31 -28
  51. package/identify-types.d.ts +10 -10
  52. package/index.d.ts +0 -6
  53. package/index.js +0 -2
  54. package/match-rejection-types.d.ts +6 -6
  55. package/match-stream-types.d.ts +32 -32
  56. package/match-stream.d.ts +2 -2
  57. package/match-stream.js +55 -41
  58. package/match-types.d.ts +8 -8
  59. package/material-asset-types.d.ts +26 -26
  60. package/material-block-types.d.ts +6 -6
  61. package/material-query-plan-types.d.ts +26 -26
  62. package/material-resources-client.d.ts +5 -5
  63. package/material-resources-client.js +10 -20
  64. package/material-types.d.ts +12 -12
  65. package/ndjson.js +16 -8
  66. package/operations.d.ts +6 -6
  67. package/operations.js +9 -39
  68. package/package.json +1 -1
  69. package/palette-completion-types.d.ts +22 -22
  70. package/palette-search-types.d.ts +28 -28
  71. package/query-understanding-types.d.ts +38 -35
  72. package/render-assets-types.d.ts +8 -8
  73. package/resolve-client.d.ts +2 -2
  74. package/resolve-client.js +4 -6
  75. package/resolve-colour-types.d.ts +8 -8
  76. package/resolve-types.d.ts +10 -10
  77. package/run-types.d.ts +70 -70
  78. package/runs.d.ts +13 -26
  79. package/runs.js +77 -89
  80. package/samplize-catalogue-types.d.ts +18 -18
  81. package/samplize-colorvec.d.ts +20 -20
  82. package/samplize-colorvec.js +66 -42
  83. package/schema-resource-types.d.ts +38 -38
  84. package/schema-resource-types.js +5 -5
  85. package/search-card-types.d.ts +4 -4
  86. package/search-collapse-types.d.ts +4 -4
  87. package/search-mood-types.d.ts +2 -2
  88. package/search-refinement-types.d.ts +8 -8
  89. package/search-request-types.d.ts +5 -5
  90. package/search-response-receipt-types.d.ts +58 -42
  91. package/search-response-types.d.ts +2 -2
  92. package/search-result-validation.d.ts +3 -3
  93. package/search-result-validation.js +53 -36
  94. package/search-window-types.d.ts +2 -2
  95. package/slot-pool-types.d.ts +20 -20
  96. package/source-material-validation.d.ts +3 -3
  97. package/source-material-validation.js +35 -39
  98. package/spec-facet-types.d.ts +10 -10
  99. package/spec-types.d.ts +6 -6
  100. package/specifications.d.ts +9 -25
  101. package/specifications.js +15 -21
  102. package/sse.d.ts +2 -2
  103. package/sse.js +32 -16
  104. package/substitute-types.d.ts +22 -22
  105. package/suggest-types.d.ts +7 -7
  106. package/suggest-types.js +3 -3
  107. package/taxonomy-coverage-types.d.ts +8 -8
  108. package/types.d.ts +119 -119
  109. package/validation.d.ts +26 -26
  110. package/validation.js +97 -92
  111. package/webmcp.d.ts +2 -2
  112. package/webmcp.generated.js +94 -93
  113. package/project-types.d.ts +0 -79
  114. package/project-types.js +0 -9
  115. package/projects.d.ts +0 -13
  116. package/projects.js +0 -46
  117. package/run-events.d.ts +0 -106
  118. package/run-events.js +0 -32
  119. package/schedule-reference-types.d.ts +0 -46
  120. package/schedule-reference-types.js +0 -1
  121. package/schedule-references-client.d.ts +0 -14
  122. package/schedule-references-client.js +0 -26
  123. package/schedule-types.d.ts +0 -261
  124. package/schedule-types.js +0 -1
@@ -1,79 +0,0 @@
1
- /**
2
- * Wire types for the persistent Material Box project surface (`/api/v1/projects`).
3
- * Hand-mirrored from `@materialgraph/products/projects`' Zod contract — the SDK
4
- * has zero runtime dependency on `@materialgraph/*`. Kept shape-identical to the
5
- * server contract; the OpenAPI parity test gates method/path/operationId, and the
6
- * server route schemas gate the body shapes.
7
- *
8
- * THE LENS: a project is the DESIGNER'S OWN record — an append-only trail of
9
- * what they attached, asked, preferred and adopted. It holds no material data of
10
- * its own; every `variantId`, `batchId` and `runId` in it is a reference into
11
- * the other lenses. Read the folded collections on {@link ProjectState}; the raw
12
- * `events` log is there for audit, not for reconstruction.
13
- *
14
- * Every id here is OPAQUE — round-trip verbatim, never parse or construct one.
15
- */
16
- import type { BatchId, ProjectId, RunId, VariantId } from "./identifiers.js";
17
- /** The six governed project-event kinds. */
18
- export type ProjectEventKind = "batch-attached" | "run-started" | "clarifying-answer" | "pairwise-preference" | "reference-chosen" | "scheme-adopted";
19
- /** The frozen tuple of every project-event kind, for enumeration. */
20
- export declare const PROJECT_EVENT_KINDS: readonly ProjectEventKind[];
21
- /** One clarifying question and the designer's answer. */
22
- export interface ClarifyingAnswer {
23
- question: string;
24
- answer: string;
25
- }
26
- /** One pairwise preference; `chosenId` is `leftId` or `rightId`. All three opaque. */
27
- export interface PairwisePreference {
28
- leftId: VariantId;
29
- rightId: VariantId;
30
- chosenId: VariantId;
31
- }
32
- /** One stored event; `payload` is validated to the shape of `kind`. */
33
- export interface ProjectEvent {
34
- eventId: string;
35
- kind: ProjectEventKind;
36
- payload: Record<string, unknown>;
37
- createdAt: string;
38
- }
39
- /** A lightweight project row for list views (no event fold). */
40
- export interface ProjectSummary {
41
- /** Opaque — round-trip verbatim. */
42
- projectId: ProjectId;
43
- principalId: string;
44
- name: string;
45
- createdAt: string;
46
- updatedAt: string;
47
- }
48
- /** A project's assembled read model — identity plus the folded event collections. */
49
- export interface ProjectState extends ProjectSummary {
50
- /** Source-material batches attached, oldest first. Opaque. */
51
- batchIds: BatchId[];
52
- /** Runs started from this project, oldest first. Opaque. */
53
- runIds: RunId[];
54
- answers: ClarifyingAnswer[];
55
- preferences: PairwisePreference[];
56
- chosenReferences: string[];
57
- adoptedSchemes: string[];
58
- events: ProjectEvent[];
59
- }
60
- /** `GET /api/v1/projects` — the caller's projects, newest first. */
61
- export interface ProjectListResponse {
62
- projects: ProjectSummary[];
63
- }
64
- /** `POST /api/v1/projects` request body. */
65
- export interface CreateProjectRequest {
66
- name?: string;
67
- }
68
- /** `POST /api/v1/projects/{projectId}/events` request body. */
69
- export interface AppendProjectEventRequest {
70
- kind: ProjectEventKind;
71
- payload: Record<string, unknown>;
72
- }
73
- /** `POST /api/v1/projects/{projectId}/events` response — the appended event receipt. */
74
- export interface ProjectEventReceipt {
75
- eventId: string;
76
- projectId: ProjectId;
77
- kind: ProjectEventKind;
78
- createdAt: string;
79
- }
package/project-types.js DELETED
@@ -1,9 +0,0 @@
1
- /** The frozen tuple of every project-event kind, for enumeration. */
2
- export const PROJECT_EVENT_KINDS = Object.freeze([
3
- "batch-attached",
4
- "run-started",
5
- "clarifying-answer",
6
- "pairwise-preference",
7
- "reference-chosen",
8
- "scheme-adopted",
9
- ]);
package/projects.d.ts DELETED
@@ -1,13 +0,0 @@
1
- import { HttpTransport } from "./http-transport.js";
2
- import type { AppendProjectEventRequest, CreateProjectRequest, ProjectEventReceipt, ProjectListResponse, ProjectState } from "./project-types.js";
3
- /** Create a project (`POST /api/v1/projects`). Requires the `mg:ingest` scope. */
4
- export declare function createProject(transport: HttpTransport, body?: CreateProjectRequest, signal?: AbortSignal): Promise<ProjectState>;
5
- /** Read a project's assembled state (`GET /api/v1/projects/{projectId}`). */
6
- export declare function getProject(transport: HttpTransport, projectId: string, signal?: AbortSignal): Promise<ProjectState>;
7
- /**
8
- * Append one event to a project's process trail
9
- * (`POST /api/v1/projects/{projectId}/events`). Requires the `mg:ingest` scope.
10
- */
11
- export declare function appendProjectEvent(transport: HttpTransport, projectId: string, body: AppendProjectEventRequest, signal?: AbortSignal): Promise<ProjectEventReceipt>;
12
- /** List your own projects, newest first (`GET /api/v1/projects`). */
13
- export declare function listProjects(transport: HttpTransport, signal?: AbortSignal): Promise<ProjectListResponse>;
package/projects.js DELETED
@@ -1,46 +0,0 @@
1
- /**
2
- * The persistent-project namespace of the SDK. Thin wrappers over the shared
3
- * {@link HttpTransport} for the `/api/v1/projects` surface: create a project,
4
- * read its assembled state, append process-trail events, and list your own.
5
- * Box's proxy routes are thin wrappers over exactly these calls.
6
- */
7
- import { MaterialGraphError } from "./errors.js";
8
- import { HttpTransport } from "./http-transport.js";
9
- import { findSdkOperation } from "./operations.js";
10
- function projectOperation(operationId) {
11
- const match = findSdkOperation(operationId);
12
- if (!match)
13
- throw MaterialGraphError.unexpected(`Unknown SDK operation: ${operationId}`);
14
- return match;
15
- }
16
- /** Create a project (`POST /api/v1/projects`). Requires the `mg:ingest` scope. */
17
- export function createProject(transport, body = {}, signal) {
18
- return transport.requestJson(projectOperation("create_box_project"), {
19
- body,
20
- signal,
21
- });
22
- }
23
- /** Read a project's assembled state (`GET /api/v1/projects/{projectId}`). */
24
- export function getProject(transport, projectId, signal) {
25
- return transport.requestJson(projectOperation("get_box_project"), {
26
- pathParams: { projectId },
27
- signal,
28
- });
29
- }
30
- /**
31
- * Append one event to a project's process trail
32
- * (`POST /api/v1/projects/{projectId}/events`). Requires the `mg:ingest` scope.
33
- */
34
- export function appendProjectEvent(transport, projectId, body, signal) {
35
- return transport.requestJson(projectOperation("append_box_project_event"), {
36
- body,
37
- pathParams: { projectId },
38
- signal,
39
- });
40
- }
41
- /** List your own projects, newest first (`GET /api/v1/projects`). */
42
- export function listProjects(transport, signal) {
43
- return transport.requestJson(projectOperation("list_box_projects"), {
44
- signal,
45
- });
46
- }
package/run-events.d.ts DELETED
@@ -1,106 +0,0 @@
1
- import type { RunEvent } from "./run-types.js";
2
- /**
3
- * Typed payloads for the composition Run event family — the friction fix flagged
4
- * by the MG-443 walk. These narrow the loose {@link RunEvent.payloadJson} so
5
- * consumers (the Box console) can render phase progress, the parsed programme,
6
- * and the criteria-correction UI without re-typing each payload at the call
7
- * site.
8
- *
9
- * Both wire generations are covered: the CURRENT `composition.*` strings the
10
- * server emits today, and the LEGACY `material-box.*` strings kept for read-side
11
- * dual-read compatibility. Shapes mirror
12
- * `packages/mastra/src/workflow/composition/events.ts` and the
13
- * `reviewCriteriaSuspendPayloadSchema` in `@materialgraph/products` — expressed
14
- * as standalone TS types (no cross-package import; the SDK is publishable).
15
- */
16
- import type { OpenEnum } from "./types.js";
17
- export declare const COMPOSITION_PHASE_EVENT_TYPES: readonly ["composition.phase", "material-box.phase"];
18
- export declare const COMPOSITION_PROGRAMME_EVENT_TYPES: readonly ["composition.programme", "material-box.brief"];
19
- export declare const COMPOSITION_REVIEW_CRITERIA_EVENT_TYPES: readonly ["composition.review-criteria", "material-box.review-criteria"];
20
- export type CompositionPhaseEventType = (typeof COMPOSITION_PHASE_EVENT_TYPES)[number];
21
- export type CompositionProgrammeEventType = (typeof COMPOSITION_PROGRAMME_EVENT_TYPES)[number];
22
- export type CompositionReviewCriteriaEventType = (typeof COMPOSITION_REVIEW_CRITERIA_EVENT_TYPES)[number];
23
- /** Payload of a `composition.phase` / `material-box.phase` progress event. */
24
- export interface CompositionPhasePayload {
25
- workflow: OpenEnum<"parse-material-brief" | "compose-material-schemes">;
26
- phase: string;
27
- label: string;
28
- state: OpenEnum<"started" | "completed" | "failed">;
29
- /** Additive narration (file names, error messages); absent on older events. */
30
- detail?: string;
31
- /** Additive tallies (slot/candidate/scheme counts); absent on older events. */
32
- counts?: Record<string, number>;
33
- }
34
- /**
35
- * Payload of a `composition.programme` / `material-box.brief` event. The current
36
- * generation carries `programme`; the legacy generation carried `brief`. Both
37
- * are read structurally (the parsed programme document).
38
- */
39
- export interface CompositionProgrammePayload {
40
- programme?: unknown;
41
- brief?: unknown;
42
- }
43
- /** One unresolved brief phrase offered for human correction at the review step. */
44
- export interface CompositionReviewCriteriaSuggestion {
45
- attributeId: string;
46
- name: string;
47
- term?: string;
48
- score: number;
49
- }
50
- /** Exact UTF-16 passage retained from the brief; no page coordinate is implied. */
51
- export interface CompositionBriefCriterionSourceRef {
52
- sourceId: string;
53
- quote: string;
54
- textRange: {
55
- start: number;
56
- end: number;
57
- unit: "utf16";
58
- };
59
- }
60
- export interface CompositionReviewCriteriaUnresolved {
61
- slotId: string;
62
- /** Unresolved negative language requires an explicit review decision. */
63
- polarity?: "exclusion";
64
- raw: string;
65
- sourceRefs?: CompositionBriefCriterionSourceRef[];
66
- /**
67
- * Ranked corrections, best first. MG-994: every one of these is an attribute
68
- * the slot's own category holds accepted values for, so accepting the top
69
- * suggestion can never leave the slot unfillable.
70
- */
71
- suggestions: CompositionReviewCriteriaSuggestion[];
72
- /**
73
- * MG-994: attribute ids ranked for this phrase and then withheld — the slot's
74
- * category holds no accepted value for them. ABSENT when nothing was withheld
75
- * (absent means nothing was removed, not that nothing could be).
76
- */
77
- withheld?: string[];
78
- }
79
- /**
80
- * Payload of a `composition.review-criteria` / `material-box.review-criteria`
81
- * suspend event — the correction grammar the Box review step renders.
82
- */
83
- export interface CompositionReviewCriteriaPayload {
84
- unresolved: CompositionReviewCriteriaUnresolved[];
85
- }
86
- export interface CompositionPhaseEvent extends RunEvent {
87
- type: CompositionPhaseEventType;
88
- payloadJson: CompositionPhasePayload;
89
- }
90
- export interface CompositionProgrammeEvent extends RunEvent {
91
- type: CompositionProgrammeEventType;
92
- payloadJson: CompositionProgrammePayload;
93
- }
94
- export interface CompositionReviewCriteriaEvent extends RunEvent {
95
- type: CompositionReviewCriteriaEventType;
96
- payloadJson: CompositionReviewCriteriaPayload;
97
- }
98
- /** The discriminated union of all composition Run events. */
99
- export type CompositionEvent = CompositionPhaseEvent | CompositionProgrammeEvent | CompositionReviewCriteriaEvent;
100
- /**
101
- * Narrow a {@link RunEvent} to the composition family by its `type`, returning
102
- * `null` for lifecycle events (`queued`, `running`, `succeeded`, …) and any
103
- * unknown type. Narrowing is by the discriminating `type` only — payloads are
104
- * trusted structurally per the tolerant-parsing contract, never re-validated.
105
- */
106
- export declare function parseRunEvent(event: RunEvent): CompositionEvent | null;
package/run-events.js DELETED
@@ -1,32 +0,0 @@
1
- // ── Wire event-type strings (both generations) ───────────────────────────────
2
- export const COMPOSITION_PHASE_EVENT_TYPES = [
3
- "composition.phase",
4
- "material-box.phase",
5
- ];
6
- export const COMPOSITION_PROGRAMME_EVENT_TYPES = [
7
- "composition.programme",
8
- "material-box.brief",
9
- ];
10
- export const COMPOSITION_REVIEW_CRITERIA_EVENT_TYPES = [
11
- "composition.review-criteria",
12
- "material-box.review-criteria",
13
- ];
14
- const includesType = (types, type) => types.includes(type);
15
- /**
16
- * Narrow a {@link RunEvent} to the composition family by its `type`, returning
17
- * `null` for lifecycle events (`queued`, `running`, `succeeded`, …) and any
18
- * unknown type. Narrowing is by the discriminating `type` only — payloads are
19
- * trusted structurally per the tolerant-parsing contract, never re-validated.
20
- */
21
- export function parseRunEvent(event) {
22
- if (includesType(COMPOSITION_PHASE_EVENT_TYPES, event.type)) {
23
- return event;
24
- }
25
- if (includesType(COMPOSITION_PROGRAMME_EVENT_TYPES, event.type)) {
26
- return event;
27
- }
28
- if (includesType(COMPOSITION_REVIEW_CRITERIA_EVENT_TYPES, event.type)) {
29
- return event;
30
- }
31
- return null;
32
- }
@@ -1,46 +0,0 @@
1
- /** A personal preference; diminished references stay on the research board. */
2
- export type ScheduleReferenceInfluence = "kept" | "diminished";
3
- export interface PutScheduleReferenceFeedback {
4
- /** Reuse unchanged after an uncertain response; a different command needs a new id. */
5
- requestId: string;
6
- /** The version last read for this reference, or zero before its first decision. */
7
- expectedFeedbackVersion: number;
8
- sourceRunId: string;
9
- influence: ScheduleReferenceInfluence;
10
- }
11
- export type ScheduleReferenceSource = {
12
- kind: "image";
13
- laneId: string;
14
- imageRef: string;
15
- sourceName: string;
16
- sourceDomain: string;
17
- url: string | null;
18
- caption: string;
19
- } | {
20
- kind: "web";
21
- domain: string;
22
- url: string;
23
- statement: string;
24
- implication: string;
25
- };
26
- /** Immutable receipt for one decision, including the exact research frame it came from. */
27
- export interface ScheduleReferenceFeedback {
28
- eventId: string;
29
- scheduleId: string;
30
- referenceId: string;
31
- version: number;
32
- requestId: string;
33
- sourceRunId: string;
34
- sourceEventSequence: number;
35
- source: ScheduleReferenceSource;
36
- scope: {
37
- kind: "project";
38
- };
39
- originalVerdict: "kept" | "set-aside";
40
- influence: ScheduleReferenceInfluence;
41
- decidedByPrincipalId: string;
42
- decidedAt: string;
43
- }
44
- export interface ScheduleReferenceFeedbackList {
45
- items: ScheduleReferenceFeedback[];
46
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,14 +0,0 @@
1
- import type { HttpTransport } from "./http-transport.js";
2
- import type { PutScheduleReferenceFeedback, ScheduleReferenceFeedback, ScheduleReferenceFeedbackList } from "./schedule-reference-types.js";
3
- /** Schedule-owned preferences, independent of an issued document's revision. */
4
- export declare class ScheduleReferencesClient {
5
- #private;
6
- constructor(transport: HttpTransport);
7
- /** Read the latest saved preference for each reference. Empty means no decisions yet. */
8
- list(scheduleId: string, signal?: AbortSignal): Promise<ScheduleReferenceFeedbackList>;
9
- /**
10
- * Save or reverse a preference. An exact request replay returns its original receipt;
11
- * it does not undo newer decisions. A stale reference version raises a 409.
12
- */
13
- put(scheduleId: string, referenceId: string, input: PutScheduleReferenceFeedback, signal?: AbortSignal): Promise<ScheduleReferenceFeedback>;
14
- }
@@ -1,26 +0,0 @@
1
- import { resolveOperation } from "./operations.js";
2
- /** Schedule-owned preferences, independent of an issued document's revision. */
3
- export class ScheduleReferencesClient {
4
- #transport;
5
- constructor(transport) {
6
- this.#transport = transport;
7
- }
8
- /** Read the latest saved preference for each reference. Empty means no decisions yet. */
9
- list(scheduleId, signal) {
10
- return this.#transport.requestJson(resolveOperation("list_schedule_reference_feedback"), {
11
- pathParams: { scheduleId },
12
- signal,
13
- });
14
- }
15
- /**
16
- * Save or reverse a preference. An exact request replay returns its original receipt;
17
- * it does not undo newer decisions. A stale reference version raises a 409.
18
- */
19
- put(scheduleId, referenceId, input, signal) {
20
- return this.#transport.requestJson(resolveOperation("put_schedule_reference_feedback"), {
21
- pathParams: { scheduleId, referenceId },
22
- body: input,
23
- signal,
24
- });
25
- }
26
- }
@@ -1,261 +0,0 @@
1
- import type { VerdictCitation } from "./citation-types.js";
2
- /**
3
- * Finish-schedule wire types (MG-616) — the hand-mirror of
4
- * `@materialgraph/products/schemes/finish-schedule`. Kept in their own module
5
- * rather than `types.ts`, which sits at its source-size baseline.
6
- *
7
- * A finish schedule is a completed compose scheme rendered as ONE ROW PER SLOT:
8
- * the shape a specifier issues. The contract that makes it trustworthy is that
9
- * every row carries the IDENTICAL, fixed column set, and every attribute cell
10
- * states its own verification alongside its value. An unknown is an explicit
11
- * `missing` cell with a null value — never a blank that reads as complete.
12
- *
13
- * ABSENT IS NOT FALSE, enforced structurally: because the column set is fixed,
14
- * "we do not know" has to be SAID rather than omitted. Read
15
- * {@link FinishScheduleCell.state} before printing `value`.
16
- *
17
- * MG-1351 added the schedule's organising principle: every row carries an
18
- * {@link FinishScheduleRow.code} L-code under a numbered section, rows arrive in
19
- * READING order, slots with nothing specified are served as
20
- * {@link FinishSchedule.openSlots}, and a row may carry or-equal
21
- * {@link FinishScheduleAlternate}s. Read `alternates` with
22
- * {@link FinishSchedule.alternatesResolved}: an empty list means either "we did
23
- * not ask" or "there is none", and those are different claims.
24
- */
25
- import type { RunId, SchemeId, SlotId, VariantId } from "./identifiers.js";
26
- /** One schedule column: the attribute and its header text. */
27
- export interface FinishScheduleColumn {
28
- attributeId: string;
29
- /** The registry presentation label. */
30
- label: string;
31
- }
32
- /**
33
- * The six verification states a schedule cell can report, mirroring the shared
34
- * verdict contract. On this public surface a `proposed` (pending-review) value
35
- * is projected to `missing`, so it can never be told apart from a value that
36
- * never existed.
37
- */
38
- export type FinishScheduleCellState = "matched" | "deviated" | "failed" | "unverified" | "missing" | "not_evaluated";
39
- /**
40
- * One attribute cell of one row: the value AND how far it can be trusted.
41
- *
42
- * Columns the Run's criteria evaluated carry the real verdict state. Columns
43
- * backfilled from the catalogue (nothing in the brief asked about them) only
44
- * ever read `matched` or `missing`: they assert presence-with-trust, not that
45
- * the brief was met.
46
- */
47
- export interface FinishScheduleCell {
48
- attributeId: string;
49
- label: string;
50
- /** The display value, or null when unknown. */
51
- value: string | null;
52
- state: FinishScheduleCellState;
53
- confidence: number | null;
54
- sourceBasis: string | null;
55
- /** Omitted when the exact current claim has no supporting source. */
56
- citation?: VerdictCitation;
57
- }
58
- /**
59
- * The rolled-up grade for one row, from its EVALUATED criterion cells only.
60
- * `meets_all` is all-green on the required cells; `close` means something
61
- * deviated, went unverified or was missing — never round it up to a pass;
62
- * `hard_no` means a required cell failed on a real value.
63
- */
64
- export type FinishScheduleGrade = "meets_all" | "close" | "hard_no";
65
- /** Exact retained brief passage behind a schedule criterion. */
66
- export interface FinishScheduleCriterionSourceRef {
67
- sourceId: string;
68
- quote: string;
69
- textRange: {
70
- start: number;
71
- end: number;
72
- unit: "utf16";
73
- };
74
- }
75
- /** Brief criterion carried into the issued row, including explicit exclusions. */
76
- export type FinishScheduleCriterion = {
77
- kind: "attribute" | "attribute-presence" | "attribute-exclusion" | "attribute-numeric" | "unresolved";
78
- raw: string;
79
- attributeId?: string;
80
- term?: string;
81
- comparator?: "at-least" | "at-most";
82
- value?: number;
83
- unit?: string;
84
- polarity?: "exclusion";
85
- coverageNote?: string;
86
- suggestion?: {
87
- attributeId: string;
88
- term?: string;
89
- };
90
- sourceRefs?: FinishScheduleCriterionSourceRef[];
91
- };
92
- /** One numbered section of the schedule, and the heading it prints. */
93
- export interface FinishScheduleSection {
94
- /** The hundreds block, e.g. `100`. Also the base of every line number in it. */
95
- code: number;
96
- name: string;
97
- }
98
- /**
99
- * What MaterialGraph claims about an alternate — and never more than it can
100
- * support. None of the three means "interchangeable": accepting an alternate is
101
- * a specification decision, and this API does not make it.
102
- *
103
- * `or_equal` matched the specified material's equivalence signature with every
104
- * supporting value above its confidence floor. `or_equal_unverified` matched the
105
- * same signature on values that did not clear it. `successor` is the brand's own
106
- * declared replacement, from a reviewed relationship rather than a spec match —
107
- * its verdict cells are `not_evaluated` by construction.
108
- */
109
- export type FinishScheduleAlternateStance = "or_equal" | "or_equal_unverified" | "successor";
110
- /** One criterion of the equivalence signature an alternate was matched on. */
111
- export interface FinishScheduleAlternateCriterion {
112
- role: "primary_material" | "performance";
113
- attributeId: string;
114
- term: string;
115
- }
116
- /**
117
- * Why an alternate is on the row. Every field is evidence, not adjective — a
118
- * substitute presented without its basis looks like a decision when it is a
119
- * lookup, so this is never absent from an alternate.
120
- */
121
- export interface FinishScheduleAlternateBasis {
122
- /** The SPECIFIED variant this alternate was graded against. Opaque. */
123
- specifiedVariantId: VariantId;
124
- /** The product-type form the signature was projected in; null for a successor. */
125
- form: string | null;
126
- /** The criteria that matched. Empty for a successor: nothing was matched. */
127
- signature: FinishScheduleAlternateCriterion[];
128
- /** The seed-relative report card, projected exactly as row cells are. */
129
- verdict: {
130
- cells: FinishScheduleCell[];
131
- grade: FinishScheduleGrade;
132
- minConfidence: number | null;
133
- };
134
- }
135
- /** One or-equal line sitting beneath the specified line it answers. */
136
- export interface FinishScheduleAlternate {
137
- stance: FinishScheduleAlternateStance;
138
- /** Opaque — round-trip verbatim into the material lenses. */
139
- variantId: VariantId;
140
- brand: string;
141
- product: string;
142
- variant: string;
143
- /**
144
- * The colourway, when the catalogue names one. Carried separately because a
145
- * substitute's `variant` is frequently the product name repeated, and a line
146
- * that cannot name the colour has not named a material.
147
- */
148
- colour: string | null;
149
- imageUrl: string | null;
150
- hex: string | null;
151
- recordUrl: string;
152
- /**
153
- * Further colourways of this same product that also cleared the signature and
154
- * were collapsed into this line. A COUNTED collapse: `0` means this product
155
- * offered exactly one match, never that the count is unknown.
156
- */
157
- otherColourways: number;
158
- basis: FinishScheduleAlternateBasis;
159
- }
160
- /** A slot holding a code with nothing specified against it yet. */
161
- export interface FinishScheduleOpenSlot {
162
- code: string;
163
- sectionCode: number;
164
- sectionName: string;
165
- line: number;
166
- slotId: SlotId;
167
- slotName: string;
168
- space: string | null;
169
- /**
170
- * Why this line is blank, in words — or `null` when nothing measured a reason.
171
- *
172
- * `null` is NOT "nothing was found". It means no diagnosis was recorded for
173
- * this slot, most often because it was never searched, and it must not be
174
- * rendered as a search that came back empty.
175
- */
176
- reason: string | null;
177
- }
178
- /** One row: one slot, one specified material, fully graded. */
179
- export interface FinishScheduleRow {
180
- /** Criteria carried from the programme; absent on older schedule artifacts. */
181
- criteria?: FinishScheduleCriterion[];
182
- requiredCriteria?: FinishScheduleCriterion[];
183
- preferredCriteria?: FinishScheduleCriterion[];
184
- /**
185
- * The printed line reference, e.g. `L-101` — how a drawing, an RFI or a
186
- * substitution request names this line. Allocated from the Run's PROGRAMME
187
- * rather than its picks, so recomposing the scheme, varying it, or accepting a
188
- * substitution renumbers nothing.
189
- */
190
- code: string;
191
- /** The hundreds block this line sits in, e.g. `100`. */
192
- sectionCode: number;
193
- sectionName: string;
194
- /** The 1-based line within its (space, section) group. */
195
- line: number;
196
- slotId: SlotId;
197
- slotName: string;
198
- /** The space NAME, or null for a spaceless slot. */
199
- space: string | null;
200
- element: string | null;
201
- /** True when the designer pinned this pick rather than the engine choosing it. */
202
- anchored: boolean;
203
- brand: string;
204
- product: string;
205
- variant: string;
206
- /** Opaque — round-trip verbatim into the material lenses. */
207
- variantId: VariantId;
208
- /** Relative path to the public material record (`/materials/{variantId}`). */
209
- recordUrl: string;
210
- imageUrl: string | null;
211
- hex: string | null;
212
- /** Always the full, identically-ordered column set. */
213
- attributes: FinishScheduleCell[];
214
- fitNotes: string[];
215
- grade: FinishScheduleGrade;
216
- /**
217
- * Or-equal alternates for this line. An empty array is AMBIGUOUS on its own —
218
- * read it with {@link FinishSchedule.alternatesResolved}.
219
- */
220
- alternates: FinishScheduleAlternate[];
221
- }
222
- /** A whole composed scheme as an issuable finish schedule. */
223
- export interface FinishSchedule {
224
- runId: RunId;
225
- schemeId: SchemeId;
226
- title: string;
227
- /** The compose contract version stamped on the Run, or `"unknown"`. */
228
- composeVersion: string;
229
- /** ISO timestamp the export was compiled at. */
230
- generatedAt: string;
231
- /** The stable column order every row's `attributes` array follows. */
232
- columns: FinishScheduleColumn[];
233
- /**
234
- * The section table to group by, in schedule order. A section may carry no
235
- * rows: three are reserved so their conventional numbers are held rather than
236
- * reused, and any section can simply be unspecified in this scheme.
237
- */
238
- sections: FinishScheduleSection[];
239
- /** In READING order — space, then section, then line. Not pick order. */
240
- rows: FinishScheduleRow[];
241
- /**
242
- * Slots holding a code with nothing specified against them. Served explicitly
243
- * because a schedule that omitted them would read as complete.
244
- */
245
- openSlots: FinishScheduleOpenSlot[];
246
- /**
247
- * Whether the or-equal lookup RAN. When false, no row's empty `alternates`
248
- * may be read as "no alternate exists".
249
- */
250
- alternatesResolved: boolean;
251
- }
252
- /** `GET /api/v1/runs/{runId}/schedule`. */
253
- export interface FinishScheduleResponse {
254
- schedule: FinishSchedule;
255
- }
256
- /** Options for {@link getRunSchedule}. */
257
- export interface GetRunScheduleOptions {
258
- /** Which composed scheme to export; defaults to the Run's first scheme. Opaque. */
259
- schemeId?: SchemeId;
260
- signal?: AbortSignal;
261
- }
package/schedule-types.js DELETED
@@ -1 +0,0 @@
1
- export {};