UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

25 lines • 956 B
const collectors = new WeakMap(); const observers = new WeakMap(); export function onGoalLifecycleChange(owner, listener) { observers.set(owner, listener); return () => { if (observers.get(owner) === listener) observers.delete(owner); }; } /** Capture every transition synchronously; a later file reread may have missed a close. */ export function goalLifecycleChanged(owner, goal) { observers.get(owner)?.(goal); } /** The goal builtin owns its timers/latches; lifecycle reads the same live collector. */ export function registerGoalLifecycleCollector(owner, collect) { collectors.set(owner, collect); return () => { if (collectors.get(owner) === collect) collectors.delete(owner); }; } export function collectGoalLifecycleFacts(owner, restoredEnd, goal) { return collectors.get(owner)?.(restoredEnd, goal) ?? Promise.resolve(undefined); } //# sourceMappingURL=lifecycle-facts.js.map