naisys
Version:
NAISYS - Autonomous AI agent runner with built-in context management and cost tracking
24 lines • 689 B
JavaScript
/**
* Tracks what the command loop is currently blocking on. The loop calls
* `setState` before each significant hold; between holds the last-set value
* is stale but brief. The onChange callback fires an immediate heartbeat so
* supervisors see transitions without waiting for the next interval tick.
*/
export function createCommandLoopState(onChange) {
let state = "Initializing";
function setState(next) {
if (state === next) {
return;
}
state = next;
onChange?.();
}
function getState() {
return state;
}
return {
setState,
getState,
};
}
//# sourceMappingURL=commandLoopState.js.map