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.

WorkerEngine

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

An async proxy of ExpressionEngine’s core evaluate methods.

Each method mirrors its synchronous counterpart but returns a Promise of the serialisable DTO rather than a live Value, and accepts an AbortSignal.

evaluateDocument(input, options?): Promise<SerializedParsingResult>;

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

Evaluate a whole document off-thread through the incremental pass, which can re-run a line, so goal seek resolves. Mirrors the evaluateDocument helper from solve-engine/engine, and answers value for value as it does on the main thread.

ParameterType
inputstring
options?WorkerCallOptions

Promise<SerializedParsingResult>


evaluateExpression(expression, options?): Promise<SerializedWorkerValue>;

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

Evaluate a single expression off-thread. Mirrors ExpressionEngine.evaluateExpression.

ParameterType
expressionstring
options?WorkerCallOptions

Promise<SerializedWorkerValue>


evaluateLines(lines, options?): Promise<SerializedParsedLine[]>;

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

Evaluate an array of lines off-thread. Mirrors ExpressionEngine.evaluateLines.

ParameterType
linesstring[]
options?WorkerCallOptions

Promise<SerializedParsedLine[]>


explainLine(expression, options?): Promise<SerializedExplanation>;

Defined in: packages/engine/src/worker/client.ts:128

The derivation of how a line reached its answer. Mirrors ExpressionEngine.explainLine.

ParameterType
expressionstring
options?WorkerCallOptions

Promise<SerializedExplanation>


findReferences(
text,
position,
options?
): Promise<VariableReference[]>;

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

Every place the variable at position is named. Mirrors LanguageService.findReferences.

ParameterType
textstring
positionDocumentPosition
options?WorkerCallOptions

Promise<VariableReference[]>


getCompletions(
lineText,
cursorOffset,
options?
): Promise<CompletionItem[]>;

Defined in: packages/engine/src/worker/client.ts:148

Completions at a cursor. Mirrors LanguageService.getCompletions on the worker’s engine.

ParameterType
lineTextstring
cursorOffsetnumber
options?WorkerCallOptions

Promise<CompletionItem[]>


getDefinition(
text,
position,
options?
): Promise<
| VariableReference
| null>;

Defined in: packages/engine/src/worker/client.ts:152

The definition the variable at position reads. Mirrors LanguageService.getDefinition.

ParameterType
textstring
positionDocumentPosition
options?WorkerCallOptions

Promise< | VariableReference | null>


getSemanticTokens(
lineText,
lineNumber,
options?
): Promise<SemanticToken[]>;

Defined in: packages/engine/src/worker/client.ts:146

Highlighting for one line. Mirrors LanguageService.getSemanticTokens on the worker’s engine.

ParameterType
lineTextstring
lineNumbernumber
options?WorkerCallOptions

Promise<SemanticToken[]>


onAsyncError(listener): () => void;

Defined in: packages/engine/src/worker/client.ts:173

Subscribe to live-data resolutions that failed. Returns an unsubscribe function. See onResolved; this is its failure channel.

ParameterType
listener(error) => void

() => void


onResolved(listener): () => void;

Defined in: packages/engine/src/worker/client.ts:168

Subscribe to live-data resolutions that land after a request already answered.

A currency, weather or historical-rate value resolves inside the worker some time after parseDocument returned its pending result. When it does, the affected lines are re-evaluated worker-side and their fresh values arrive here as one batch. This is a subscription rather than a per-request promise because a resolution is tied to no single request: it belongs to whichever document is current when the value lands. Returns an unsubscribe function.

ParameterType
listener(lines) => void

() => void


parseDocument(input, options?): Promise<SerializedParsingResult>;

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

Parse a whole document off-thread. Mirrors ExpressionEngine.parseDocument.

ParameterType
inputstring
options?Partial<UnifiedParsingOptions> & WorkerCallOptions

Promise<SerializedParsingResult>


rename(
text,
position,
newName,
options?
): Promise<RenameResult>;

Defined in: packages/engine/src/worker/client.ts:154

Rename the variable at position. Mirrors LanguageService.rename, refusals included.

ParameterType
textstring
positionDocumentPosition
newNamestring
options?WorkerCallOptions

Promise<RenameResult>


settle(options?): Promise<void>;

Defined in: packages/engine/src/worker/client.ts:144

Wait until the worker’s in-flight live values have settled. Mirrors ExpressionEngine.settle: rejects with SETTLE_TIMEOUT at the deadline, and the settled values arrive through onResolved as ever.

ParameterType
options?{ timeoutMs?: number; } & WorkerCallOptions

Promise<void>


shiftLineReferences(
text,
change,
options?
): Promise<LineShiftResult>;

Defined in: packages/engine/src/worker/client.ts:156

The edits that keep line N references in place after lines move. Mirrors LanguageService.shiftLineReferences.

ParameterType
textstring
changeLineShift
options?WorkerCallOptions

Promise<LineShiftResult>


terminate(): void;

Defined in: packages/engine/src/worker/client.ts:175

Reject every in-flight request and tear the transport down. Idempotent.

void


traceLine(
input,
lineNumber,
options?
): Promise<SerializedLineTrace>;

Defined in: packages/engine/src/worker/client.ts:134

Where line lineNumber of input got its answer. Mirrors ExpressionEngine.traceLine, reading the document through the incremental pass (the one just evaluated, when input is the same text).

ParameterType
inputstring
lineNumbernumber
options?{ maxDepth?: number; maxLines?: number; } & WorkerCallOptions

Promise<SerializedLineTrace>


whatIf(
input,
overrides,
options?
): Promise<SerializedParsingResult>;

Defined in: packages/engine/src/worker/client.ts:126

Re-run a document with some inputs changed, off-thread. Mirrors ExpressionEngine.whatIf. Each override is a finite number or text the worker evaluates on its own ("$120"); a Value cannot cross the boundary with its type, so send its text instead.

ParameterType
inputstring
overridesWorkerWhatIfOverrides
options?WorkerCallOptions

Promise<SerializedParsingResult>