Skip to content

This site describes solve-engine as it is on main: 2.43.0, which npm does not have yet. npm installs 2.40.0, so a page may show an answer that version does not give yet.

SerializedWorkerValue

Defined in: packages/engine/src/worker/dto.ts:62

A single evaluated value, projected onto clone-safe fields.

text is the formatted display string a host renders, and number is the numeric reading (Value.toNumber), present for every type (0 where a value has no numeric meaning, matching the engine’s own convention). The type-specific fields below carry the rest of the payload where it does not fit in a plain number: bigint as a base-ten string, matrix and range as their own shapes.

optional bigint?: string;

Defined in: packages/engine/src/worker/dto.ts:108

Base-ten string for a bigint payload, so no BigInt ever crosses JSON.


optional calendarName?: CalendarName;

Defined in: packages/engine/src/worker/dto.ts:179

For a String that is a weekday or month name drawn from a date, which one it names ({ kind: "weekday", index: 2 } for Tuesday), present only then. text is already written in the settings’ language; this lets a host that renders its own text name the day in its own. See Value.calendarName.


optional chart?: {
domain: [number, number];
expr?: string;
kind: string;
label: string;
points: [number, number][];
range: [number, number];
};

Defined in: packages/engine/src/worker/dto.ts:136

Chart payload, present only for ValueType.Chart: the specification a host renders with its own charting library. kind selects the renderer (sparkline/plot); points are the (x, y) to draw, scaled to domain × range; label is the plain-text answer; expr is the source expression for a plot. The engine emits data, never pixels. See issues #186, #187.

domain: [number, number];
optional expr?: string;
kind: string;
label: string;
points: [number, number][];
range: [number, number];

optional colour?: {
a: number;
b: number;
css: string;
format: ColourFormat;
g: number;
hex: string;
r: number;
};

Defined in: packages/engine/src/worker/dto.ts:119

Colour payload, present only for ValueType.Colour. hex is the canonical #rrggbb/#rrggbbaa; r,g,b are 0-255, a is 0-1; format is the authored form; css is a render-ready CSS string, so a host draws a swatch (e.g. background: css) with no recomputation.

a: number;
b: number;
css: string;
format: ColourFormat;
g: number;
hex: string;
r: number;

optional errorCode?: string;

Defined in: packages/engine/src/worker/dto.ts:106

The error’s code (INCOMPATIBLE_UNITS, UNDEFINED_FUNCTION), present only for ValueType.Error, so a host branches on the code the way it would on a main-thread value’s errorCode, rather than on the message text (#662).


optional frozen?: FrozenMark;

Defined in: packages/engine/src/worker/dto.ts:207

Present only on a frozen answer: when it was frozen and the key it is stored under. See Value.frozen.


optional grain?: DatetimeGrain;

Defined in: packages/engine/src/worker/dto.ts:166

What a ValueType.Datetime anchors, present only when the engine recorded it: "date" for a calendar day, "datetime" for a wall-clock reading, "instant" for a fixed point, "time" for a time of day. See Value.grain. A plain JSON string, so the DTO’s structuredClone/JSON guarantee is unaffected.


optional ipCidr?: {
addr?: number;
addr6?: string;
prefix?: number;
text: string;
zone?: string;
};

Defined in: packages/engine/src/worker/dto.ts:150

IP/CIDR payload, present only for ValueType.IpCidr: the 32-bit IPv4 addr or the 128-bit IPv6 addr6 (as a decimal string, since JSON cannot carry a bigint) and its zone, and/or the prefix, plus text (the form the answer shows). See issues #189 and #748.

optional addr?: number;
optional addr6?: string;
optional prefix?: number;
text: string;
optional zone?: string;

optional matrix?: SerializedMatrix;

Defined in: packages/engine/src/worker/dto.ts:110

Matrix shape and cells, present only for ValueType.Matrix.


optional nonFinite?: "NaN" | "Infinity" | "-Infinity";

Defined in: packages/engine/src/worker/dto.ts:80

Set only when the numeric reading is non-finite (1/0, 0/0, an overflow), to a string a host turns back into the value with Number(...). Carried separately because a non-finite number cannot cross JSON; see number.


number: number;

Defined in: packages/engine/src/worker/dto.ts:74

The numeric reading via Value.toNumber: 0 for non-numeric types. Always finite so the DTO survives JSON (which turns Infinity/NaN into null): when the true reading is non-finite this is 0 and nonFinite names the real value. Read nonFinite ? Number(nonFinite) : number to recover it.


optional range?: {
max: number;
min: number;
};

Defined in: packages/engine/src/worker/dto.ts:112

Inclusive integer range bounds, present only for ValueType.Range.

max: number;
min: number;

optional sources?: ValueSource[];

Defined in: packages/engine/src/worker/dto.ts:205

Where the live figures behind this value came from, present only when it carries any: each record’s provider, kind, fetch time, and when relevant its subject, its day and its freeze time. See Value.sources. Every field is a string or a number, so the DTO’s structuredClone/JSON guarantee is unaffected.


text: string;

Defined in: packages/engine/src/worker/dto.ts:66

The formatted display string, what a host renders against the line.


optional timeAnchor?: number;

Defined in: packages/engine/src/worker/dto.ts:185

For a time of day (grain "time"), an instant on the day it is counted from, in epoch milliseconds, present only when recorded: the day a time-zone answer’s (+1 day) is counted from. See Value.timeAnchor.


optional timecodeFps?: number;

Defined in: packages/engine/src/worker/dto.ts:93

Set only for a video timecode (01:02:03:04 at 30 fps): its frame rate. number is then the frame count and unit is frames, so a host never sees the engine’s internal unit name for a timecode (#759).


optional timedOut?: boolean;

Defined in: packages/engine/src/worker/dto.ts:158

Whether an async fallback timed out, carried through when the engine set it.


optional timePrecision?: "minute";

Defined in: packages/engine/src/worker/dto.ts:190

For a time of day written to the minute, as a time-zone answer is (7:00 PM), "minute", present only then. See Value.timePrecision.


type: ValueType;

Defined in: packages/engine/src/worker/dto.ts:64

The ValueType discriminant (a number), so a host can branch on the kind.


optional unit?: string;

Defined in: packages/engine/src/worker/dto.ts:87

Unit annotation for unit-of-measurement and non-decimal-base values, when present. Never set for an ValueType.Error: its message is in text, and its code in errorCode. A timecode crosses as frames, its count, with the rate in timecodeFps.


optional unitLabel?: {
name: string;
per: number;
};

Defined in: packages/engine/src/worker/dto.ts:100

The name a quantity is shown under when the reader wrote a word for its unit that is not the unit’s own (Meile, sprints), and how many of unit one of it is. The text is already written under it; this is for a host that renders the number itself (#762).

name: string;
per: number;

optional zone?: string;

Defined in: packages/engine/src/worker/dto.ts:172

The zone a Datetime should be read in, present only when the line named one: an IANA name ("Asia/Tokyo") or a fixed offset ("UTCOFFSET:540"). See Value.zone.


optional zoneDifference?: ZoneDifference;

Defined in: packages/engine/src/worker/dto.ts:197

For a time difference between two places (Tokyo is 8 hours ahead of London), the two places as the reader named them, present only then. The value is the signed gap in hours, positive when to is ahead. See Value.zoneDifference.