// src/memory-action-policy.ts
var HIGH_IMPORTANCE_DISCARD_THRESHOLD = 0.8;
var LOW_CONFIDENCE_DEFER_THRESHOLD = 0.35;
function evaluateMemoryActionPolicy(input) {
  const { action, eligibility, options } = input;
  if (!options.actionsEnabled) {
    return {
      action,
      decision: "deny",
      rationale: "contextCompressionActionsEnabled=false",
      eligibility
    };
  }
  if (options.maxCompressionTokensPerHour === 0 && action === "summarize_node") {
    return {
      action,
      decision: "defer",
      rationale: "maxCompressionTokensPerHour=0",
      eligibility
    };
  }
  if (action === "discard" && eligibility.importance >= HIGH_IMPORTANCE_DISCARD_THRESHOLD) {
    return {
      action,
      decision: "deny",
      rationale: "importance_too_high_for_discard",
      eligibility
    };
  }
  if ((eligibility.lifecycleState === "archived" || eligibility.lifecycleState === "stale") && (action === "update_note" || action === "create_artifact" || action === "link_graph")) {
    return {
      action,
      decision: "deny",
      rationale: `lifecycle_state_${eligibility.lifecycleState}_restricted`,
      eligibility
    };
  }
  if (eligibility.source !== "unknown" && eligibility.confidence < LOW_CONFIDENCE_DEFER_THRESHOLD && action !== "discard") {
    return {
      action,
      decision: "defer",
      rationale: "confidence_below_threshold",
      eligibility
    };
  }
  return {
    action,
    decision: "allow",
    rationale: "eligible",
    eligibility
  };
}

export {
  evaluateMemoryActionPolicy
};
//# sourceMappingURL=chunk-H63EDPFJ.js.map