Skip to content

TypeScript core types

Public TypeScript types and report contracts re-exported by the SDK.

Finding

Source: sdk/ts/src/ops.ts

Verify rendered preview
Sample: VerifyCheck a resolved design against machine-safety contracts and inspect findings.typescript: docs/site/examples/verify.ts · python: docs/site/examples/verify.py
ts
export interface Finding

Single verification finding, optionally tied to a resolved segment index.

Fields

FieldTypeRequiredSummary
rulestringYesStable rule identifier, such as bounds or peak-acceleration.
severitySeverityYesWhether the finding blocks the contract or is advisory.
segmentnumber | nullYesZero-based segment index, or null when the finding is global.
messagestringYesHuman-readable finding details.

MachineKinematics

Source: sdk/ts/src/engine.ts

ts
export interface MachineKinematics

Machine kinematic limits used by resolveBalancedIr and resolveVerify. Field names are snake_case to match the Rust serde serialization. All fields are optional; an unset field disables the corresponding check.

  • max_acceleration_mm_s2 — peak centripetal acceleration ceiling (mm/s²).
  • max_junction_velocity_mm_s — per-junction speed-change ceiling (mm/s).

Fields

FieldTypeRequiredSummary
max_acceleration_mm_s2numberNoDeclared in the public API.
max_junction_velocity_mm_snumberNoDeclared in the public API.

Metrics

Source: sdk/ts/src/ops.ts

ts
export interface Metrics

Simulation metrics returned by simulate.

Fields

FieldTypeRequiredSummary
total_time_snumberYesTotal estimated time in seconds.
print_time_snumberYesEstimated extruding move time in seconds.
travel_time_snumberYesEstimated travel move time in seconds.
extruding_distancenumberYesTotal extruding path length in mm.
travel_distancenumberYesTotal non-extruding path length in mm.
extruded_volumenumberYesDeposited material volume in cubic mm.
filament_lengthnumberYesFilament consumed in mm.
segment_countnumberYesNumber of resolved toolpath segments.
max_flow_ratenumberYesMaximum observed flow rate in cubic mm/s.

Op

Source: sdk/ts/src/ops.ts

ts
export type Op = | { op: 'geometry'; width: number; height: number }
  | { op: 'extruder'; on: boolean }
  | { op: 'speed'; print: number }
  | { op: 'move'; x: number | null; y: number | null; z: number | null }
  | {
      op: 'arc';
      cx: number;
      cy: number;
      x: number | null;
      y: number | null;
      z: number | null;
      clockwise: boolean;
    }
  | { op: 'spline'; points: [number | null, number | null, number | null][] }
  // process channels (§3): typed, defaulted, propagated by the engine.
  | { op: 'temperature'; nozzle: number }
  | { op: 'fan'; speed: number }
  | { op: 'flow'; ratio: number }
  | { op: 'tool'; index: number }
  | { op: 'orient'; i: number; j: number; k: number }
  | { op: 'dwell'; seconds: number }
  | { op: 'manual_gcode'; text: string }
  | { op: 'retract'; distance: number | null; speed: number | null }
  | { op: 'unretract'; distance: number | null; speed: number | null }
  | { op: 'deposit'; volume: number; speed: number }

Authoring operation in Dry L1, before resolution into concrete toolpath segments.

PRINTERS

Source: sdk/ts/src/ops.ts

ts
export const PRINTERS: Record<string, ResolveParams>

Device defaults (the generic printer). More profiles land with the device-profile work.

Report

Source: sdk/ts/src/ops.ts

Verify rendered preview
Sample: VerifyCheck a resolved design against machine-safety contracts and inspect findings.typescript: docs/site/examples/verify.ts · python: docs/site/examples/verify.py
ts
export interface Report

Verification result containing all findings emitted by enabled rules.

Fields

FieldTypeRequiredSummary
findingsFinding[]YesDeclared in the public API.

RESOLVE_PARAMS

Source: sdk/ts/src/ops.ts

ts
export const RESOLVE_PARAMS: ResolveParams

Default resolver parameters for the generic built-in printer profile.

resolveBalancedIr

Source: sdk/ts/src/engine.ts

ts
export function resolveBalancedIr(ops: Op[], params: ResolveParams, kinematics?: MachineKinematics): Toolpath

Resolve a design through the kinematics-aware balanced optimization pipeline. When kinematics is provided its acceleration/junction-velocity limits shape the output (acceleration clamping + junction-velocity capping). Omitting kinematics falls back to the safe pipeline (same as resolveOptimizedIr).

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes
kinematicsMachineKinematicsNo

Returns: Toolpath

resolveBinary

Source: sdk/ts/src/engine.ts

ts
export function resolveBinary(ops: Op[], params: ResolveParams): Uint8Array

Resolve a design and return the L2 Dry IR encoded as the binary DRY1 format (raw bytes).

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes

Returns: Uint8Array

resolveGcode

Source: sdk/ts/src/engine.ts

ts
export function resolveGcode(ops: Op[], params: ResolveParams, relativeE = true, travelG1E0 = false, fiveAxis = false, rotaryAxes = 'ab'): string[]

Resolve a design and emit motion g-code. rotaryAxes is the rotary-axes selector (the ab/ac/bc STRING) choosing which two rotary axes carry the toolframe orientation in 5-axis emit — distinct from the machine motion-limits MachineKinematics object used by resolveBalancedIr / resolveVerify.

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes
relativeEanytrueNo
travelG1E0anyfalseNo
fiveAxisanyfalseNo
rotaryAxesany'ab'No

Returns: string[]

resolveIr

Source: sdk/ts/src/engine.ts

ts
export function resolveIr(ops: Op[], params: ResolveParams): Toolpath

Resolve a design to the L2 Dry IR.

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes

Returns: Toolpath

resolveMetrics

Source: sdk/ts/src/engine.ts

ts
export function resolveMetrics(ops: Op[], params: ResolveParams): Metrics

Resolve a design and return its simulation metrics.

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes

Returns: Metrics

resolveMetricsIr

Source: sdk/ts/src/engine.ts

ts
export function resolveMetricsIr(irJson: string): Metrics

Simulate an already-resolved Dry IR ({ version, segments }) and return its metrics. Unlike resolveMetrics, which simulates an L1 design, this takes a toolpath IR directly — so a caller can report the before/after time and peak flow of an optimized or balanced IR (which has no originating op-list). irJson is the JSON string of a Toolpath (e.g. the result of JSON.stringify on an optimizedIr/balancedIr toolpath).

Parameters

ParameterTypeDefaultRequired
irJsonstringYes

Returns: Metrics

resolveOptimizedIr

Source: sdk/ts/src/engine.ts

ts
export function resolveOptimizedIr(ops: Op[], params: ResolveParams): Toolpath

Resolve a design through the standard L2 optimization pipeline.

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes

Returns: Toolpath

ResolveParams

Source: sdk/ts/src/ops.ts

ts
export interface ResolveParams

The lowering defaults (print/travel feedrate, filament diameter) — mirrors the engine's ResolveParams.

Fields

FieldTypeRequiredSummary
print_speednumberYesDefault extrusion feedrate in mm/min.
travel_speednumberYesDefault travel feedrate in mm/min.
dianumberYesFilament diameter in mm.

resolveVerify

Source: sdk/ts/src/engine.ts

ts
export function resolveVerify(ops: Op[], params: ResolveParams, maxFlow = 0, minTemp = 0, bounds?: Float64Array, monotonicZ = false, speedRange?: Float64Array, maxRetractionDistance = 0, maxRetractionSpeed = 0, maxTravelWithoutRetract = 0, firstLayerHeightRange?: Float64Array, firstLayerSpeedRange?: Float64Array, kinematics?: MachineKinematics): Report

Resolve a design and verify it against safety contracts. The structured limits cross to the wasm engine as native typed values — bounds flat as [x0,x1,y0,y1,z0,z1] and each range as [min,max] (a Float64Array, or undefined to disable that check); the scalar ceilings use 0 to mean unset. The optional kinematics arg enables the peak-acceleration and junction-velocity verify rules.

Parameters

ParameterTypeDefaultRequired
opsOp[]Yes
paramsResolveParamsYes
maxFlowany0No
minTempany0No
boundsFloat64ArrayNo
monotonicZanyfalseNo
speedRangeFloat64ArrayNo
maxRetractionDistanceany0No
maxRetractionSpeedany0No
maxTravelWithoutRetractany0No
firstLayerHeightRangeFloat64ArrayNo
firstLayerSpeedRangeFloat64ArrayNo
kinematicsMachineKinematicsNo

Returns: Report

Segment

Source: sdk/ts/src/ops.ts

ts
export interface Segment

One resolved motion or process segment in the Dry L2 IR.

Fields

FieldTypeRequiredSummary
start(number | null)[]YesDeclared in the public API.
end(number | null)[]YesDeclared in the public API.
travelbooleanYesDeclared in the public API.
speednumberYesDeclared in the public API.
lengthnumberYesDeclared in the public API.
volumenumberYesDeclared in the public API.
filamentnumberYesDeclared in the public API.
widthnumber | nullYesDeclared in the public API.
heightnumber | nullYesDeclared in the public API.
kindSegmentKindYesDeclared in the public API.
centre[number, number] | nullYesDeclared in the public API.
clockwisebooleanYesDeclared in the public API.
temperaturenumberNoDeclared in the public API.
fannumberNoDeclared in the public API.
flownumberNoDeclared in the public API.
toolnumberNoDeclared in the public API.
dwell_snumberNoDeclared in the public API.
manual_gcodestringNoDeclared in the public API.
orientation[number, number, number]NoDeclared in the public API.
control_points[number, number, number][]NoDeclared in the public API.

SegmentKind

Source: sdk/ts/src/ops.ts

ts
export type SegmentKind = | 'line'
  | 'arc'
  | 'spline'
  | 'dwell'
  | 'retract'
  | 'unretract'
  | 'deposit'
  | 'manual_gcode'

One resolved L2 motion segment.

Severity

Source: sdk/ts/src/ops.ts

Verify rendered preview
Sample: VerifyCheck a resolved design against machine-safety contracts and inspect findings.typescript: docs/site/examples/verify.ts · python: docs/site/examples/verify.py
ts
export type Severity = 'error' | 'warning'

Severity level for a verification finding.

Toolpath

Source: sdk/ts/src/ops.ts

ts
export interface Toolpath

The resolved L2 Dry IR.

Fields

FieldTypeRequiredSummary
versionnumberYesDeclared in the public API.
metaToolpathMetaNoDeclared in the public API.
segmentsSegment[]YesDeclared in the public API.

ToolpathMeta

Source: sdk/ts/src/ops.ts

ts
export interface ToolpathMeta

Optional provenance and invariant metadata attached to a resolved toolpath.

Fields

FieldTypeRequiredSummary
generatorstringNoName of the generator or pipeline that produced the toolpath.
unitsstringNoCoordinate and unit convention, normally millimeters.
source_hashstringNoStable source hash when the toolpath was derived from an external artifact.
invariantsstring[]NoHuman-readable invariants the toolpath is expected to satisfy.