/** * Identity of the JavaScript thread this module instance runs on. * * The main thread is always `"main"`. Subagent host workers are numbered * `w1`, `w2`, … by the main-thread pool and set their id once during * bootstrap. Agent sessions record the thread that owns them ("home") so * other threads can route calls to the owner instead of touching a copy. */ /** Owning thread of an agent session or other thread-bound object. */ export type ThreadId = "main" | `w${number}`; /** Thread id of this module instance; `"main"` unless a worker bootstrap set it. */ export declare function currentThreadId(): ThreadId; /** Whether this module instance runs on the main thread. */ export declare function isMainThread(): boolean; /** Worker bootstrap only: record the pool-assigned id before any session is created. */ export declare function setCurrentThreadId(id: ThreadId): void; /** Narrow an untrusted value (e.g. decoded wire data) to a {@link ThreadId}. */ export declare function isThreadId(value: unknown): value is ThreadId;