@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
29 lines (28 loc) • 1.34 kB
TypeScript
/**
* A deadline a tool call can pause while it waits for a human.
*
* A model loop bounds each tool call. A call that needs a confirmation spends
* part of that bound waiting for a person, which says nothing about the tool,
* so the confirmation pauses the bound and resumes it afterwards with the time
* that was left, never a fresh one.
*/
import type { PauseDeadline, PausableDeadline } from "../../types/index.js";
/**
* Arms a deadline of `ms` that calls `onExpire` once when it runs out.
*
* - `pause()` stops the clock and returns the resume function. Paused time is
* not spent: resuming re-arms the timer with what was left. Pauses nest; the
* clock runs again only once every pause has resumed, and each resume
* function acts once.
* - `clear()` ends the deadline for good: `onExpire` never runs, and a resume
* that arrives later re-arms nothing.
*
* The timer is deliberately not unref'd: while a call is in flight it may be
* the only thing that will end a wedged tool.
*/
export declare function createPausableDeadline(ms: number, onExpire: () => void): PausableDeadline;
/**
* The `pauseDeadline` in a tool's execute options (the second argument a
* model loop passes), or undefined when there is none.
*/
export declare function pauseDeadlineOf(execOptions: unknown): PauseDeadline | undefined;