UNPKG

@code-yeongyu/senpi

Version:

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

24 lines • 901 B
export function selectTip(definitions, history, now, options = {}) { void now; const keys = options.keys; const hasCommand = options.hasCommand; let oldestTip; let oldestTimestamp = Number.POSITIVE_INFINITY; for (const tip of definitions) { if (options.exclude?.has(tip.id)) continue; if (keys && tip.bindings.length > 0 && tip.bindings.every((binding) => keys(binding) === "")) continue; if (hasCommand && tip.requiresCommand !== undefined && !hasCommand(tip.requiresCommand)) continue; if (!Object.hasOwn(history, tip.id)) return tip; const lastShown = history[tip.id]; if (oldestTip === undefined || lastShown < oldestTimestamp) { oldestTip = tip; oldestTimestamp = lastShown; } } return oldestTip; } //# sourceMappingURL=scheduler.js.map