/**
 * Session threshold constants and utilities
 *
 * Shared module for determining when to trigger diary/evaluation actions.
 * Counters accumulate across resume/exit cycles until threshold is reached.
 *
 * Canonical source — hooks import this directly (there is no hooks/lib/ layer).
 */

const MIN_USER_MESSAGES = 10;
const MIN_TOOL_CALLS = 50;

/**
 * Check if session activity meets threshold for diary trigger.
 * Uses OR logic: either meaningful conversation OR substantive tool work suffices.
 * @param {number} userCount - Number of user messages
 * @param {number} toolCount - Number of tool calls
 * @returns {boolean} True if threshold is met
 */
function shouldTrigger(userCount, toolCount) {
  return userCount >= MIN_USER_MESSAGES || toolCount >= MIN_TOOL_CALLS;
}

module.exports = {
  MIN_USER_MESSAGES,
  MIN_TOOL_CALLS,
  shouldTrigger,
};
