Skip to main content
Shared component execution and query contracts. No component owns this SDK layer.

Type Aliases

AccessRequest

Ƭ AccessRequest: Infer<typeof accessRequest>

AccessGrant

Ƭ AccessGrant: Infer<typeof accessGrant>

AccessPolicy

Ƭ AccessPolicy: FunctionReference<"query", "public" | "internal", AccessRequest, AccessGrant>

PageOptions

Ƭ PageOptions: Infer<typeof pageOptions>

Issue

Ƭ Issue: Infer<typeof issue>

ReviewProposer

Ƭ ReviewProposer: "you" | "another" | null Who proposed an item, reduced to what the reader can act on.

ReviewTarget

Ƭ ReviewTarget: Object Which of the owning component’s declared operations reviews the item, and the arguments the shared dialog is opened with. operation is the export name inside the component (review, release); preset holds strings the dialog parses against the operation’s own validators.

Type declaration


ReviewOption

Ƭ ReviewOption: Object One option of a ReviewChoice: its stable id within the item, what the reader sees, and the arguments it adds to the target’s preset.

Type declaration


ReviewChoice

Ƭ ReviewChoice: Object A decision the review needs before it can be requested: label asks the question, and exactly one option is picked. The component still rechecks the picked value inside its operation.

Type declaration


ReviewEvidenceRow

Ƭ ReviewEvidenceRow: Object One row of ReviewEvidence: what the row is about and one value per column.

Type declaration


ReviewEvidence

Ƭ ReviewEvidence: Object A bounded, read-only account of what a review item rests on. columns name the sides shown: one column for a plain summary, several for a comparison. Each row holds exactly one value per column. comparison says the later columns are compared with the first, so a reader may be shown where their text differs (a byte comparison, never the owner’s scoring rule). isComplete is false when rows, columns or text were cut to the contract’s bounds.

Type declaration


ReviewProgress

Ƭ ReviewProgress: Object An item’s quorum as the component recorded it at the read: the distinct approvals counted so far, how many the item requires, and this reader’s own vote, if they cast one.

Type declaration


ReviewItem

Ƭ ReviewItem: Object One item awaiting an independent reviewer.

Type declaration


ReviewQueuePage

Ƭ ReviewQueuePage: Object One bounded page of a component’s review queue.

Type declaration


ReviewQueueReference

Ƭ ReviewQueueReference: FunctionReference<"query", "public", Record<string, never>, ReviewQueuePage> The reference a component’s ./workspace entry declares as reviewQueue and its ./application helper serves. It takes no arguments: the bound and the order are the contract’s.

Variables

selectionContext

• Const selectionContext: VUnion<{ kind: "promotion" ; previous: null | string ; evaluation: { id: string; run: string; contract: string; digest: string; suite: string; recorder: string; executor: string; findings: { value: number; target: number; metric: string; passes: boolean; }[]; references: { …; }[]; } ; channel: string ; candidate: { id: string; run: string; digest: string; producer: string; artifact: string; registeredBy: string; } ; adapter: { key: string; contract: string; } } | { kind: "withdrawal" ; version: null | string ; previous: string ; channel: string }, [VObject<{ kind: "promotion" ; previous: null | string ; evaluation: { id: string; run: string; contract: string; digest: string; suite: string; recorder: string; executor: string; findings: { value: number; target: number; metric: string; passes: boolean; }[]; references: { …; }[]; } ; channel: string ; candidate: { id: string; run: string; digest: string; producer: string; artifact: string; registeredBy: string; } ; adapter: { key: string; contract: string; } }, { kind: VLiteral<"promotion", "required"> ; channel: VString<string, "required"> ; previous: VUnion<null | string, [VNull<null, "required">, VString<string, "required">], "required", never> ; candidate: VObject<{ id: string ; run: string ; digest: string ; producer: string ; artifact: string ; registeredBy: string }, { id: VString<string, "required"> ; run: VString<string, "required"> ; artifact: VString<string, "required"> ; digest: VString<string, "required"> ; producer: VString<string, "required"> ; registeredBy: VString<string, "required"> }, "required", "id" | "run" | "digest" | "producer" | "artifact" | "registeredBy"> ; evaluation: VObject<{ id: string ; run: string ; contract: string ; digest: string ; suite: string ; recorder: string ; executor: string ; findings: { value: number; target: number; metric: string; passes: boolean; }[] ; references: { contract: string; dataset: string; versionId: string; }[] }, { id: VString<string, "required"> ; run: VString<string, "required"> ; suite: VString<string, "required"> ; contract: VString<string, "required"> ; digest: VString<string, "required"> ; recorder: VString<string, "required"> ; executor: VString<string, "required"> ; findings: VArray<{ value: number ; target: number ; metric: string ; passes: boolean }[], VObject<{ value: number ; target: number ; metric: string ; passes: boolean }, { metric: VString<string, "required"> ; value: VFloat64<number, "required"> ; target: VFloat64<number, "required"> ; passes: VBoolean<boolean, "required"> }, "required", "value" | "target" | "metric" | "passes">, "required"> ; references: VArray<{ contract: string ; dataset: string ; versionId: string }[], VObject<{ contract: string ; dataset: string ; versionId: string }, { versionId: VString<string, "required"> ; dataset: VString<string, "required"> ; contract: VString<string, "required"> }, "required", "contract" | "dataset" | "versionId">, "required"> }, "required", "id" | "run" | "contract" | "digest" | "suite" | "recorder" | "executor" | "findings" | "references"> ; adapter: VObject<{ key: string ; contract: string }, { key: VString<string, "required"> ; contract: VString<string, "required"> }, "required", "key" | "contract"> }, "required", "kind" | "previous" | "evaluation" | "channel" | "candidate" | "adapter" | "evaluation.id" | "evaluation.run" | "evaluation.contract" | "evaluation.digest" | "evaluation.suite" | "evaluation.recorder" | "evaluation.executor" | "evaluation.findings" | "evaluation.references" | "candidate.id" | "candidate.run" | "candidate.digest" | "candidate.producer" | "candidate.artifact" | "candidate.registeredBy" | "adapter.key" | "adapter.contract">, VObject<{ kind: "withdrawal" ; version: null | string ; previous: string ; channel: string }, { kind: VLiteral<"withdrawal", "required"> ; channel: VString<string, "required"> ; previous: VString<string, "required"> ; version: VUnion<null | string, [VNull<null, "required">, VString<string, "required">], "required", never> }, "required", "kind" | "version" | "previous" | "channel">], "required", "kind" | "version" | "previous" | "evaluation" | "channel" | "candidate" | "adapter" | "evaluation.id" | "evaluation.run" | "evaluation.contract" | "evaluation.digest" | "evaluation.suite" | "evaluation.recorder" | "evaluation.executor" | "evaluation.findings" | "evaluation.references" | "candidate.id" | "candidate.run" | "candidate.digest" | "candidate.producer" | "candidate.artifact" | "candidate.registeredBy" | "adapter.key" | "adapter.contract"> Resolved by the model owner after loading and checking retained evidence.

accessRequest

• Const accessRequest: VObject<{ resource: { kind: string; key: string; } ; selection: null | { kind: “promotion”; previous: string | null; evaluation: { id: string; run: string; contract: string; digest: string; suite: string; recorder: string; executor: string; findings: { value: number; target: number; metric: string; passes: boolean; }[]; references: { …; }[]; }; channel: string; candidate: { …; }; a… | { kind: “withdrawal”; version: string | null; previous: string; channel: string; } ; operation: string ; actor: string ; approver: null | string }, { actor: VString<string, "required"> ; resource: VObject<{ kind: string ; key: string }, { kind: VString<string, "required"> ; key: VString<string, "required"> }, "required", "kind" | "key"> ; operation: VString<string, "required"> ; approver: VUnion<null | string, [VNull<null, "required">, VString<string, "required">], "required", never> ; selection: VUnion<null | { kind: "promotion" ; previous: null | string ; evaluation: { id: string; run: string; contract: string; digest: string; suite: string; recorder: string; executor: string; findings: { value: number; target: number; metric: string; passes: boolean; }[]; references: { …; }[]; } ; channel: string ; candidate: { id: string; run: string; digest: string; producer: string; artifact: string; registeredBy: string; } ; adapter: { key: string; contract: string; } } | { kind: "withdrawal" ; version: null | string ; previous: string ; channel: string }, [VNull<null, "required">, VUnion<{ kind: "promotion" ; previous: null | string ; evaluation: { id: string; run: string; contract: string; digest: string; suite: string; recorder: string; executor: string; findings: { value: number; target: number; metric: string; passes: boolean; }[]; references: { …; }[]; } ; channel: string ; candidate: { id: string; run: string; digest: string; producer: string; artifact: string; registeredBy: string; } ; adapter: { key: string; contract: string; } } | { kind: "withdrawal" ; version: null | string ; previous: string ; channel: string }, [VObject<{ kind: "promotion" ; previous: null | string ; evaluation: { id: string; run: string; contract: string; digest: string; suite: string; recorder: string; executor: string; findings: { value: number; target: number; metric: string; passes: boolean; }[]; references: { …; }[]; } ; channel: string ; candidate: { id: string; run: string; digest: string; producer: string; artifact: string; registeredBy: string; } ; adapter: { key: string; contract: string; } }, { kind: VLiteral<"promotion", "required"> ; channel: VString<string, "required"> ; previous: VUnion<null | string, [VNull<null, "required">, VString<string, "required">], "required", never> ; candidate: VObject<{ id: string ; run: string ; digest: string ; producer: string ; artifact: string ; registeredBy: string }, { id: VString<string, "required"> ; run: VString<string, "required"> ; artifact: VString<string, "required"> ; digest: VString<string, "required"> ; producer: VString<string, "required"> ; registeredBy: VString<string, "required"> }, "required", "id" | "run" | "digest" | "producer" | "artifact" | "registeredBy"> ; evaluation: VObject<{ id: string ; run: string ; contract: string ; digest: string ; suite: string ; recorder: string ; executor: string ; findings: { value: number; target: number; metric: string; passes: boolean; }[] ; references: { contract: string; dataset: string; versionId: string; }[] }, { id: VString<string, "required"> ; run: VString<string, "required"> ; suite: VString<string, "required"> ; contract: VString<string, "required"> ; digest: VString<string, "required"> ; recorder: VString<string, "required"> ; executor: VString<string, "required"> ; findings: VArray<{ value: number ; target: number ; metric: string ; passes: boolean }[], VObject<{ value: number ; target: number ; metric: string ; passes: boolean }, { metric: VString<string, "required"> ; value: VFloat64<number, "required"> ; target: VFloat64<number, "required"> ; passes: VBoolean<boolean, "required"> }, "required", "value" | "target" | "metric" | "passes">, "required"> ; references: VArray<{ contract: string ; dataset: string ; versionId: string }[], VObject<{ contract: string ; dataset: string ; versionId: string }, { versionId: VString<string, "required"> ; dataset: VString<string, "required"> ; contract: VString<string, "required"> }, "required", "contract" | "dataset" | "versionId">, "required"> }, "required", "id" | "run" | "contract" | "digest" | "suite" | "recorder" | "executor" | "findings" | "references"> ; adapter: VObject<{ key: string ; contract: string }, { key: VString<string, "required"> ; contract: VString<string, "required"> }, "required", "key" | "contract"> }, "required", "kind" | "previous" | "evaluation" | "channel" | "candidate" | "adapter" | "evaluation.id" | "evaluation.run" | "evaluation.contract" | "evaluation.digest" | "evaluation.suite" | "evaluation.recorder" | "evaluation.executor" | "evaluation.findings" | "evaluation.references" | "candidate.id" | "candidate.run" | "candidate.digest" | "candidate.producer" | "candidate.artifact" | "candidate.registeredBy" | "adapter.key" | "adapter.contract">, VObject<{ kind: "withdrawal" ; version: null | string ; previous: string ; channel: string }, { kind: VLiteral<"withdrawal", "required"> ; channel: VString<string, "required"> ; previous: VString<string, "required"> ; version: VUnion<null | string, [VNull<null, "required">, VString<string, "required">], "required", never> }, "required", "kind" | "version" | "previous" | "channel">], "required", "kind" | "version" | "previous" | "evaluation" | "channel" | "candidate" | "adapter" | "evaluation.id" | "evaluation.run" | "evaluation.contract" | "evaluation.digest" | "evaluation.suite" | "evaluation.recorder" | "evaluation.executor" | "evaluation.findings" | "evaluation.references" | "candidate.id" | "candidate.run" | "candidate.digest" | "candidate.producer" | "candidate.artifact" | "candidate.registeredBy" | "adapter.key" | "adapter.contract">], "required", "kind" | "version" | "previous" | "evaluation" | "channel" | "candidate" | "adapter" | "evaluation.id" | "evaluation.run" | "evaluation.contract" | "evaluation.digest" | "evaluation.suite" | "evaluation.recorder" | "evaluation.executor" | "evaluation.findings" | "evaluation.references" | "candidate.id" | "candidate.run" | "candidate.digest" | "candidate.producer" | "candidate.artifact" | "candidate.registeredBy" | "adapter.key" | "adapter.contract"> }, "required", "resource" | "selection" | "operation" | "actor" | "approver" | "resource.kind" | "resource.key" | "selection.kind" | "selection.version" | "selection.previous" | "selection.evaluation" | "selection.channel" | "selection.candidate" | "selection.adapter" | "selection.evaluation.id" | "selection.evaluation.run" | "selection.evaluation.contract" | "selection.evaluation.digest" | "selection.evaluation.suite" | "selection.evaluation.recorder" | "selection.evaluation.executor" | "selection.evaluation.findings" | "selection.evaluation.references" | "selection.candidate.id" | "selection.candidate.run" | "selection.candidate.digest" | "selection.candidate.producer" | "selection.candidate.artifact" | "selection.candidate.registeredBy" | "selection.adapter.key" | "selection.adapter.contract">

accessGrant

• Const accessGrant: VUnion<null | { scope: string }, [VNull<null, "required">, VObject<{ scope: string }, { scope: VString<string, "required"> }, "required", "scope">], "required", "scope">

pageOptions

• Const pageOptions: VObject<{ cursor: null | string ; limit: number }, { cursor: VUnion<null | string, [VNull<null, "required">, VString<string, "required">], "required", never> ; limit: VFloat64<number, "required"> }, "required", "cursor" | "limit"> Bounded discovery through the application’s existing policy, never an admin scan.

failureCodes

• Const failureCodes: readonly ["invalid_request", "contract_mismatch", "input_unavailable", "access_denied", "execution_failed", "archived", "study_not_finished", "evaluation_mismatch", "promotion_conflict", "state_conflict", "bound_exceeded", "independent_reviewer_required", "not_selected"]

issue

• Const issue: VObject<{ step: undefined | string ; code: "bound_exceeded" | "internal" | "invalid_request" | "archived" | "access_denied" | "contract_mismatch" | "input_unavailable" | "execution_failed" | "study_not_finished" | "evaluation_mismatch" | "promotion_conflict" | "state_conflict" | "independent_reviewer_required" | "not_selected" ; message: string ; retryable: boolean }, { code: VUnion<"bound_exceeded" | "internal" | "invalid_request" | "archived" | "access_denied" | "contract_mismatch" | "input_unavailable" | "execution_failed" | "study_not_finished" | "evaluation_mismatch" | "promotion_conflict" | "state_conflict" | "independent_reviewer_required" | "not_selected", [VLiteral<"invalid_request", "required">, VLiteral<"contract_mismatch", "required">, VLiteral<"input_unavailable", "required">, VLiteral<"access_denied", "required">, VLiteral<"execution_failed", "required">, VLiteral<"archived", "required">], "required", never> ; message: VString<string, "required"> ; retryable: VBoolean<boolean, "required"> ; step: VString<undefined | string, "optional"> }, "required", "code" | "message" | "retryable" | "step">

REQUEST_KEY_MAX

• Const REQUEST_KEY_MAX: 128 The longest request key any component accepts.

REVIEW_APPROVALS_MAX

• Const REVIEW_APPROVALS_MAX: 5 The most independent approvals one item may require.

REVIEW_QUEUE_MAX

• Const REVIEW_QUEUE_MAX: 25 The most items one component’s review queue returns.

REVIEW_CHOICE_OPTIONS_MAX

• Const REVIEW_CHOICE_OPTIONS_MAX: 32 The most options one review choice offers, and the longest label, option detail, and option or destination id an item may carry.

REVIEW_LABEL_MAX

• Const REVIEW_LABEL_MAX: 200

REVIEW_DETAIL_MAX

• Const REVIEW_DETAIL_MAX: 500

REVIEW_ID_MAX

• Const REVIEW_ID_MAX: 512

REVIEW_EVIDENCE_COLUMNS_MAX

• Const REVIEW_EVIDENCE_COLUMNS_MAX: 4 The most columns and rows one item’s evidence carries. Each cell and label is bounded by REVIEW_LABEL_MAX.

REVIEW_EVIDENCE_ROWS_MAX

• Const REVIEW_EVIDENCE_ROWS_MAX: 16

Functions

authorize

▸ authorize(ctx, handle, request, scope?): Promise<string>

Parameters

Returns

Promise<string>

permits

▸ permits(ctx, handle, requested, scope?): Promise<string | null> The same authorization, asked as a question instead of a demand. A bounded page that must omit the rows its caller may not read needs the answer, not the exception. This is not a second policy: it calls authorize — the one owner of the grant/scope rule — and turns that owner’s own typed refusal into null. Every other failure propagates, so a broken policy function is still a broken read and never a silently short page. It resolves one request. A caller filtering many rows is responsible for keeping the number of resolutions inside its page bound, which is why the filter callers here memoize by the exact (handle, resource, operation) a row carries: within one query the basis is fixed, so the same request has the same answer.

Parameters

Returns

Promise<string | null>

request

▸ request(actor, kind, key, operation, approver?, selection?): AccessRequest

Parameters

Returns

AccessRequest

bound

▸ bound(limit, max?): number An explicit result bound for a single-page inspection read. Inspection is read-mostly discovery through the containing application’s own policy, so it takes a limit instead of a cursor: the caller asks for at most max records and learns from isComplete whether more exist.

Parameters

Returns

number

pagination

▸ pagination(options): Object

Parameters

Returns

Object

canonical

▸ canonical(value): string Stable serialization of exact Bijection values for component contracts.

Parameters

Returns

string

fail

▸ fail(code, message, retryable?): never

Parameters

Returns

never

isAccessDenied

▸ isAccessDenied(error): boolean True for a component’s own refusal to disclose a resource. The single predicate every exposure helper uses to decide that one item of a bounded page is “not visible to you” rather than broken. It matches the exact typed code fail raises from authorize; a message is never inspected, and every other failure — including an error that is not a BijectionError at all — is not an access denial and must propagate.

Parameters

Returns

boolean

classify

▸ classify(error, step?): Issue

Parameters

Returns

Issue

componentOperationForwarders

▸ componentOperationForwarders<Operation>(name, operation): Object

Type parameters

Parameters

Returns

Object

requireRequestKey

▸ requireRequestKey(key): void Refuse a key that is empty or longer than REQUEST_KEY_MAX.

Parameters

Returns

void

refuseChangedRequest

▸ refuseChangedRequest(changed): void Refuse a repeat of a retained request whose arguments changed. The caller decides changed under its own contract, after any refusal that must take precedence (access to the retained request, its archival).

Parameters

Returns

void

validReviewProgress

▸ validReviewProgress(progress): boolean Whether progress is within the contract: integers with 1 <= required <= REVIEW_APPROVALS_MAX and 0 <= approvals <= required, and a vote that is one of the two verdicts or null.

Parameters

Returns

boolean

validReviewEvidence

▸ validReviewEvidence(evidence): boolean Whether evidence is within the contract: a non-empty label, 1 to REVIEW_EVIDENCE_COLUMNS_MAX columns, 1 to REVIEW_EVIDENCE_ROWS_MAX rows of exactly one value per column, and every text within REVIEW_LABEL_MAX.

Parameters

Returns

boolean

reviewEvidence

▸ reviewEvidence(input): ReviewEvidence | undefined Builds evidence within the contract from what a helper read: columns and rows beyond the bounds are dropped, text is cut, a missing cell is empty, and isComplete says whether anything was cut. undefined when there is no row or no column to show, so an item never carries an empty account.

Parameters

Returns

ReviewEvidence | undefined

validReviewChoice

▸ validReviewChoice(choice): boolean Whether a choice is within the contract: 1 to REVIEW_CHOICE_OPTIONS_MAX options with distinct non-empty ids, bounded labels and details, string presets, and preset labels that name only preset arguments.

Parameters

Returns

boolean

reviewProposer

▸ reviewProposer(actor, reader): ReviewProposer Reduces a stored principal to the contract’s proposer.

Parameters

Returns

ReviewProposer

reviewQueuePage

▸ reviewQueuePage(items, isComplete, restricted): ReviewQueuePage Builds the page every helper returns: newest first, cut to REVIEW_QUEUE_MAX, and incomplete when anything was cut. The order is proposedAt descending with the id as a deterministic tie-break.

Parameters

Returns

ReviewQueuePage

requireIndependentReview

▸ requireIndependentReview(reviewer, parties): void The one independence law every reviewing component applies inside the transaction that records a review: the reviewer is none of the parties whose work is under review (its proposer, and where the component records them, whoever registered or produced it).

Parameters

Returns

void

validateParameters

▸ validateParameters(schema, value, depth?): void The deliberately small parameter profile is checked again in the component.

Parameters

Returns

void