"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var naive_cost_exports = {};
__export(naive_cost_exports, {
  estimateNaiveCost: () => estimateNaiveCost
});
module.exports = __toCommonJS(naive_cost_exports);
const AVG_FILE_TOKENS = 1500;
const AVG_GREP_TOKENS = 800;
const AVG_FIND_TOKENS = 2e3;
function estimateNaiveCost(toolName, outputTokens, args) {
  switch (toolName) {
    case "kirograph_context": {
      const maxNodes = args?.maxNodes || 20;
      const filesEstimate = Math.min(Math.ceil(maxNodes / 2), 10);
      return filesEstimate * AVG_FILE_TOKENS;
    }
    case "kirograph_search": {
      const limit = args?.limit || 10;
      return AVG_GREP_TOKENS + Math.min(limit, 5) * (AVG_FILE_TOKENS / 3);
    }
    case "kirograph_callers": {
      const limit = args?.limit || 20;
      const callersEstimate = Math.min(limit, 10);
      return AVG_GREP_TOKENS + callersEstimate * (AVG_FILE_TOKENS / 2);
    }
    case "kirograph_callees": {
      return AVG_FILE_TOKENS + AVG_GREP_TOKENS * 3;
    }
    case "kirograph_impact": {
      const depth = args?.depth || 2;
      return (AVG_GREP_TOKENS + AVG_FILE_TOKENS * 3) * depth;
    }
    case "kirograph_node": {
      return AVG_FILE_TOKENS;
    }
    case "kirograph_files": {
      return AVG_FIND_TOKENS;
    }
    case "kirograph_status": {
      return 500;
    }
    case "kirograph_path": {
      return AVG_GREP_TOKENS * 4 + AVG_FILE_TOKENS * 3;
    }
    case "kirograph_type_hierarchy": {
      return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;
    }
    case "kirograph_dead_code": {
      return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);
    }
    case "kirograph_circular_deps": {
      return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 8);
    }
    case "kirograph_hotspots": {
      return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);
    }
    case "kirograph_surprising": {
      return Math.max(outputTokens * 5, AVG_FILE_TOKENS * 10);
    }
    case "kirograph_architecture":
    case "kirograph_coupling":
    case "kirograph_package": {
      return Math.max(outputTokens * 4, AVG_FILE_TOKENS * 5);
    }
    case "kirograph_diff": {
      return Math.max(outputTokens * 3, AVG_FILE_TOKENS * 5);
    }
    case "kirograph_mem_search": {
      const limit = args?.limit || 10;
      const filesEstimate = Math.min(Math.ceil(limit / 2), 5);
      return filesEstimate * AVG_FILE_TOKENS + AVG_GREP_TOKENS;
    }
    case "kirograph_mem_store": {
      return null;
    }
    case "kirograph_mem_timeline": {
      return AVG_FILE_TOKENS + AVG_GREP_TOKENS;
    }
    case "kirograph_mem_status": {
      return 500;
    }
    // ── Docs tools ────────────────────────────────────────────────────────────
    case "kirograph_docs_toc": {
      return AVG_FILE_TOKENS * 4 + AVG_FILE_TOKENS;
    }
    case "kirograph_docs_search": {
      const limit = args?.limit || 10;
      const filesEstimate = Math.min(Math.ceil(limit / 2), 5);
      return AVG_GREP_TOKENS + filesEstimate * AVG_FILE_TOKENS;
    }
    case "kirograph_docs_section": {
      const withContext = args?.context;
      return withContext ? AVG_FILE_TOKENS * 3 : AVG_FILE_TOKENS * 2;
    }
    case "kirograph_docs_outline": {
      return AVG_FILE_TOKENS * 2;
    }
    case "kirograph_docs_refs": {
      return AVG_GREP_TOKENS * 3 + AVG_FILE_TOKENS * 2;
    }
    // kirograph_exec and kirograph_gain are tracked separately
    default:
      return null;
  }
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  estimateNaiveCost
});
//# sourceMappingURL=naive-cost.js.map
