/** * @param {object} [options] * @param {string} [options.queuePath] - Override queue file path. * @returns {{tool: import('../types').ToolDef, readQueue: () => Promise[]>, queuePath: string}} * @when you want a tool that queues an action to a JSONL file for an external waker (cron) to fire later — two-phase governance (emit-time + fire-time) * @fails returns {tool, readQueue, queuePath}; the inner action is re-gated at fire time when the waker runs. bareguard caps via defer.ratePerMinute. * @example * const { tool } = createDeferTool(); * const loop = new Loop({ provider, tools: [tool] }); */ export function createDeferTool(options?: { queuePath?: string | undefined; }): { tool: import("../types").ToolDef; readQueue: () => Promise[]>; queuePath: string; }; /** * Read the queue and reconstruct the live status of each id by folding * append-only status lines (latest wins). Exposed for tests + library * users; the wake script does its own jq-based fold. */ /** * @param {string} [queuePath] * @name readDeferQueue * @when you want to read the deferred-action queue and reconstruct each id's live status (an external waker or a status check) * @fails never throws on a missing/empty queue; folds append-only status lines (latest wins) and returns the reconstructed records. * @example * const queue = await readDeferQueue(); */ export function readQueue(queuePath?: string): Promise[]>; /** * Generate a sortable, unique id. 9-char base36 timestamp + 20-char hex * random. Lexicographically sortable by emit time; unique enough for any * realistic defer rate. Same shape as the PRD's `def_01J...` sketch. */ export function generateId(): string; /** * Resolve the active queue path. Precedence: * 1. Caller-supplied option (createDeferTool({ queuePath: '...' })) * 2. BAREAGENT_DEFER_QUEUE env var * 3. ./bareagent-defers.jsonl */ /** @param {string} [option] */ export function resolveQueuePath(option?: string): string;