BackgroundWorker
Defined in: agents/src/runs.ts:51
Minimum worker capabilities. Server 0.19/0.20 remain valid in best-effort mode, including their child callbacks; only awaited mode needs append.
Extends
Section titled “Extends”Pick<Run, |"id"|"owner"|"input"|"checkpoint"|"resumed"|"crashes"|"signal"|"save"|"emit">
Properties
Section titled “Properties”append?
Section titled “append?”optional append?: (events) => Promise<void>;Defined in: agents/src/runs.ts:55
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
events |
readonly object[] |
Returns
Section titled “Returns”Promise<void>
checkpoint
Section titled “checkpoint”readonly checkpoint: unknown;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:142
The last save before the worker died, under restart: "resume". null otherwise.
Inherited from
Section titled “Inherited from”Pick.checkpointcrashes
Section titled “crashes”readonly crashes: number;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:146
How many times a dead worker’s run was taken over, this time included.
Inherited from
Section titled “Inherited from”Pick.crashesreadonly id: string;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:138
Inherited from
Section titled “Inherited from”Pick.idreadonly input: unknown;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:140
Inherited from
Section titled “Inherited from”Pick.inputreadonly owner: string;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:139
Inherited from
Section titled “Inherited from”Pick.ownerresumed
Section titled “resumed”readonly resumed: boolean;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:144
True when this run was started before: a worker died, or a drain put it back.
Inherited from
Section titled “Inherited from”Pick.resumedsignal
Section titled “signal”readonly signal: AbortSignal;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:151
Aborts when the run must stop. Its reason is a RunStopped saying why: lost (another
worker took the run over), cancelled or shutdown. Pass it to every provider call.
Inherited from
Section titled “Inherited from”Pick.signalMethods
Section titled “Methods”child()
Section titled “child()”child<T>( key, spec, fn): Promise<ChildResult<T>>;Defined in: agents/src/runs.ts:56
Type Parameters
Section titled “Type Parameters”| Type Parameter |
|---|
T |
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
key |
string |
spec |
ChildSpec |
fn |
(run) => Promise<T> |
Returns
Section titled “Returns”Promise<ChildResult<T>>
emit()
Section titled “emit()”emit(type, data?): void;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:174
Appends an event for tail, and returns at once. Appends run in order behind it, and the run
does not finish before they do. One that fails goes to onError; it never throws.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
type |
string |
data? |
unknown |
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”Pick.emitsave()
Section titled “save()”save(state): Promise<void>;Defined in: node_modules/.bun/@[email protected]+19b32ddeae23987b/node_modules/@gusnips/server/dist/runs/index.d.ts:156
Keeps state as the checkpoint a resumed run starts from. Throws once this worker no longer
holds the run.
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
state |
unknown |
Returns
Section titled “Returns”Promise<void>
Inherited from
Section titled “Inherited from”Pick.save