import type { CliCredentials } from '../config';
import { type AudioCheckReport, type FetchLike } from './audio';
import { type SealIssue } from './sealCheck';
import { type BytesFetch, type Json, type Requester } from './platform';
import { type ContinuumObjects, type VehicleDir } from './publish';
import { validateVehicle, type VehicleIssue } from './validate';
export type ContentRating = 'everyone' | 'teen' | 'mature' | 'adult';
export declare const CONTENT_RATINGS: readonly ContentRating[];
export type PackagePin = {
packageId: string;
version: string;
manifestCid: string;
};
/** The seal accepts only these provenance kinds (it refuses "original"). */
export declare function sealProvenanceKind(kind: unknown): 'authored' | 'imported' | 'generated';
export declare function canonicalBytes(value: unknown): Uint8Array;
export interface VehicleMintOptions {
dir: string;
glb?: string;
title?: string;
description?: string;
tags?: string[];
contentRating?: string;
/** Package Version to seal (default 1.0.0 on a first mint; required with --item). */
version?: string;
/** Publish a NEW VERSION of this existing vehicle Item instead of minting one. */
itemId?: string;
/** 1-500 chars; the version move's audit reason (with --item). */
reason?: string;
/** Ledger, finished package, descriptor and receipts (default `
/.helix-publish`). */
out?: string;
/** Validate and check audio only; nothing is uploaded. */
dryRun?: boolean;
/** Drive the package with the platform's engine instrument (`vehicle validate` default; false = `--no-simulate`). */
simulate?: boolean;
/** Drive with the last cached engine runtime; never fetch. */
offline?: boolean;
}
export interface VehicleMintLedger {
schema: 'helix.vehicle-mint-ledger/1';
intentId: string;
/** The PRIMARY model (the one the highest tier draws). Kept for a one-rendition car and for older ledgers. */
glb?: {
sha: string;
bytes: number;
url: string;
};
/** Every sealed model rendition, primary first (a multi-rendition car seals one GLB per rendition). */
models?: Array<{
sha: string;
bytes: number;
url: string;
renditionId?: string;
}>;
rootSha?: string;
packageId?: string;
version?: string;
pin?: PackagePin;
/** The sha256s of every object sealed into the Package Version closure (root, model and each upload). */
closure?: string[];
itemId?: string;
versionMove?: 'moved' | 'staged-awaiting-visual-qa';
steps: Array<{
at: string;
step: string;
detail?: unknown;
}>;
}
export interface VehicleBoardReadBack {
hostKind: string | null;
sockets: number;
paths: number;
hostGrantExtensions: Record;
ok: boolean;
problems: string[];
}
export interface VehicleMintResult {
ok: boolean;
dryRun: boolean;
itemId?: string;
slug?: string;
packagePin?: PackagePin | null;
versionMove?: 'minted' | 'moved' | 'staged-awaiting-visual-qa';
validation: {
errors: number;
warnings: number;
issues: VehicleIssue[];
};
audio: AudioCheckReport;
readBack?: {
pinMatches: boolean;
packageIdentityMatches: boolean;
meshBound: boolean;
meshPinned: boolean;
status: string;
audio: AudioCheckReport;
board: VehicleBoardReadBack;
};
files: {
ledger: string;
package: string;
descriptor?: string;
receipt?: string;
};
next: string[];
}
export interface MakeItemRequest {
packagePin: PackagePin;
intentId: string;
contentRating: ContentRating;
title: string;
description?: string;
tags?: string[];
}
/** Everything the command needs from the outside world, injectable for tests. */
export interface VehicleMintDeps {
api: Requester;
objects: ContinuumObjects;
/** Seal a Package Version from a publication intent (ContinuumPublisher.publish). */
publishPackage(intent: Json): Promise;
/** Project the exact pin into an Item (`POST /api/v1/items`, publications.makeItemFromPackage). */
makeItem(input: MakeItemRequest): Promise<{
item: {
id: string;
slug?: string;
packagePin: PackagePin;
};
}>;
fetchBytes?: BytesFetch;
fetchAudio?: FetchLike;
validate?: typeof validateVehicle;
onProgress?: (message: string) => void;
}
/** One uploaded (or already sealed) model: its exact bytes and the served rendition it belongs to, when it names one. */
export interface PinnedModel {
sha: string;
bytes: number;
url: string;
renditionId?: string;
file?: string;
}
/**
* The served mesh renditions, each pinned to the model that is its own bytes. A `source` rendition with no bytes is
* kept as the description it is.
*
* A car whose root declares more than one served rendition (the live Subaru draws two: a mobile-low GLB and the
* balanced one) is sealed with one model per rendition — matched by the rendition's own `checksumSha256` first, then
* by `model-.glb`. Two renditions that share one GLB share one file. A rendition with no model, or a model
* no rendition names, is refused rather than guessed at: pinning the wrong bytes into a rendition is how a car draws
* something other than what it sealed. Pure.
*/
export declare function pinMeshRendition(pkg: Json, glbOrModels: PinnedModel | PinnedModel[]): Json;
/** The exact vehicle-definition root: the published shape (`mesh.ref = "$self"`) with its model(s) pinned. Pure. */
export declare function vehicleRoot(pkg: Json, glbOrModels: PinnedModel | PinnedModel[], hostGrantExtensions?: unknown): Json;
/** The package identity a Vehicle Package seal names. */
export interface SealPackageIdentity {
name: string;
slug: string;
visibility: 'public' | 'private';
}
/**
* The role a variant declares for a model rendition. The engine draws from the ROOT's `artifactRef` per rendition, so
* the role is metadata — but the live corpus names it after the tier, and the server matches a variant to its rendition
* by ID (`vehicleRenditionManifestProblems`), which is why the id is the rendition's own.
*/
export declare function modelVariantRole(renditionId?: string): string;
/**
* The runtime profile a model rendition's variant declares. A car with several renditions mints the low tier as
* `web-low` (the live corpus names it so, and the update-compatibility gate refuses a version that drops a profile an
* owner already resolves), the high tier as `web-high`, every other model as `web-balanced`. `web-low` and `web-high` are each claimed once per version: the draw-call
* gate only treats a variant as an alternative rendition when its profile id is unique. A lone model serves every
* tier and stays `web-balanced`.
*/
export declare function modelVariantProfiles(models: Array<{
renditionId?: string;
}>): string[];
/**
* The exact Package publication intent `vehicle publish` seals, built from values only (no network, no upload) so the
* real publish and the dry run's seal-side validation judge the SAME object. `audio` is every uploaded WAV and
* `models` every distinct model rendition (one variant per GLB, its id the rendition it serves).
*/
export declare function vehicleSealIntent(a: {
packageId: string;
identity: SealPackageIdentity;
version: string;
rootBytes: Uint8Array;
rootSha: string;
models: Array<{
sha: string;
bytes: number;
renditionId?: string;
}>;
audio: Array<{
sha: string;
bytes: number;
}>;
provenance?: {
kind?: string;
source?: string;
};
dirName: string;
stage: boolean;
}): {
intent: Json;
objects: Json[];
};
/** Does this package drive on land (so its board must expose tunable paths)? */
export declare function isLandVehicle(pkg: unknown): boolean;
/** GET /universal-items/:id/slots, judged: a vehicle host with sockets and (on land) tunable paths. */
export declare function readVehicleBoard(api: Requester, itemId: string, opts: {
land: boolean;
grants?: unknown;
}): Promise;
/**
* The seal-side validation of a vehicle publish, with nothing uploaded: the exact intent the real publish seals (model and
* WAVs pinned by their local sha256), judged by the real seal's own preflight, plus the Package/Item fields the backend
* validates when it makes the Item. Runs in the dry run AND before the real publish uploads anything.
*/
export declare function vehicleSealCheck(vdir: VehicleDir, opts: Pick, glbBytes: Uint8Array): SealIssue[];
export declare function mintVehicle(opts: VehicleMintOptions, creds: CliCredentials, deps: VehicleMintDeps): Promise;
export declare function formatVehicleMint(r: VehicleMintResult): string;