import { type Task } from "./models.js"; import type { SubmitOptions } from "./client.js"; import type { TaskStore } from "./store/base.js"; import { type TaskDef } from "./task.js"; /** Handed to a task handler. Worker-side capabilities mirror the Python SDK. */ export declare class TaskContext { private readonly store; private readonly task; readonly workerId: string; private readonly leaseMs; private readonly abort; private leaseLost; private cancelSeen; constructor(store: TaskStore, task: Task, workerId: string, leaseMs: number); get taskId(): string; get name(): string; get queue(): string; get attempt(): number; get metadata(): any; get rootId(): string | null; get correlationId(): string | null; get payload(): any; /** * True once this worker has lost the task's lease — it expired and another * worker reclaimed it. Nothing this handler writes will be recorded any more * and the task is already running elsewhere, so a long handler should check * this (or `signal`) and bail out instead of continuing to do side effects. */ get lostLease(): boolean; /** Aborts when the lease is lost. Pass it to fetch / any AbortSignal-aware API. */ get signal(): AbortSignal; /** @internal Called by the worker when an owned write reports a lost lease. */ markLeaseLost(): void; private observe; private owned; progress(value: number | null, message?: string | null): Promise; heartbeat(): Promise; /** Cooperative cancel check. Free once a heartbeat has already seen the flag. */ canceled(): Promise; /** Submit a child task; parent/root/correlation are wired automatically. */ submit(name: string, payload?: unknown, opts?: SubmitOptions): Promise; submit(task: TaskDef, payload?: P, opts?: SubmitOptions): Promise; wait(taskId: string, opts?: { timeoutMs?: number; pollMs?: number; }): Promise; }