@just-every/task
Version:
Task - Thoughtful Task Loop
57 lines • 1.97 kB
TypeScript
/**
* Helper for thought delay processing
*/
import { ToolFunction } from '@just-every/ensemble';
import { type ThoughtDelay } from '../utils/constants.js';
export declare let thoughtDelay: ThoughtDelay;
export declare function setDelayInterrupted(interrupted: boolean): void;
export declare function isDelayInterrupted(): boolean;
export declare function getDelayAbortSignal(): AbortSignal;
export declare function getThoughtDelay(): number;
export declare function getValidThoughtDelays(): readonly number[];
/**
* Execute an optimized thought delay with interrupt support
*
* Implements intelligent delays between agent thoughts to:
* - Allow time for external processes to complete
* - Provide natural pacing for complex reasoning
* - Enable interruption for urgent messages or user input
*
* Uses AbortController for clean cancellation.
*
* @returns Promise that resolves when delay completes or is interrupted
*
* @example
* ```typescript
* // Basic delay execution
* await runThoughtDelay();
*
* // With interruption handling
* try {
* await runThoughtDelay();
* } catch (error) {
* console.log('Delay was interrupted');
* }
* ```
*/
export declare function runThoughtDelay(): Promise<void>;
/**
* Execute thought delay with a specific AbortController (task-scoped)
*
* @param controller - Task-specific AbortController
* @param delaySeconds - Delay in seconds
*/
export declare function runThoughtDelayWithController(controller: AbortController, delaySeconds: number): Promise<void>;
/**
* Set the thought delay for the agent
* @param delay - The delay to set (0, 2, 4, 8, 16, 32, 64, or 128 seconds)
* @returns The new delay value or error message
*/
export declare const setThoughtDelay: (delay: string) => string;
/**
* Get thought management tools
*
* @returns Array of tool functions for managing thought delays
*/
export declare function getThoughtTools(): ToolFunction[];
//# sourceMappingURL=thought_utils.d.ts.map