Skip to main content
begin(input, options?): HarnessSpeculativeTurn<HarnessTurnResult<HarnessParsedOutput<OutputDefinition>>>
Start a provisional streaming direct turn, with no writes or tools until commitment. Parameters Returns HarnessSpeculativeTurn<HarnessTurnResult<HarnessParsedOutput<OutputDefinition>>>

HarnessSpeculativeTurn

One speculative direct turn. Text is provisional until commit succeeds. Type Parameters Properties result
readonly result: Promise<Result>
Observed internally even when a caller discards without awaiting it. textStream
readonly textStream: AsyncIterable<string>
Single-consumer, provisional text. Consuming it must not cause persistent effects. Methods commit()
commit(confirmed): Promise<Result>
First decision wins. Same text returns the same promise; different text rejects. Parameters Returns Promise<Result> discard()
discard(): boolean
True for a discarded turn (including repeats), false after commit won. Returns boolean

HarnessSpeculationConflictError

In-memory ownership and commitment; never opens a storage transaction. Constructors Constructor
new HarnessSpeculationConflictError(): HarnessSpeculationConflictError
Returns HarnessSpeculationConflictError Properties cause?
optional cause?: unknown
code
readonly code: "HARNESS_SPECULATION_CONFLICT"
message
message: string
name
name: string
stack?
optional stack?: string
stackTraceLimit
static stackTraceLimit: number
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. Methods captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
Parameters Returns void prepareStackTrace()
static prepareStackTrace(err, stackTraces): any
Parameters Returns any See https://v8.dev/docs/stack-trace-api#customizing-stack-traces

HarnessSpeculationUnsupportedError

Constructors Constructor
new HarnessSpeculationUnsupportedError(detail): HarnessSpeculationUnsupportedError
Parameters Returns HarnessSpeculationUnsupportedError Properties cause?
optional cause?: unknown
code
readonly code: "HARNESS_SPECULATION_UNSUPPORTED"
message
message: string
name
name: string
stack?
optional stack?: string
stackTraceLimit
static stackTraceLimit: number
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames. Methods captureStackTrace()
static captureStackTrace(targetObject, constructorOpt?): void
Creates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called.
The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance:
Parameters Returns void prepareStackTrace()
static prepareStackTrace(err, stackTraces): any
Parameters Returns any See https://v8.dev/docs/stack-trace-api#customizing-stack-traces