"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 config_prompt_exports = {};
__export(config_prompt_exports, {
  DEFAULT_EMBEDDING_MODEL: () => DEFAULT_EMBEDDING_MODEL,
  promptConfigOptions: () => promptConfigOptions
});
module.exports = __toCommonJS(config_prompt_exports);
var import_prompts = require("./prompts");
const DEFAULT_EMBEDDING_MODEL = "nomic-ai/nomic-embed-text-v1.5";
const PRESET_MODELS = [
  {
    value: "nomic-ai/nomic-embed-text-v1.5",
    label: "nomic-embed-text-v1.5",
    dim: 768,
    description: "768-dim \xB7 ~130MB \xB7 Best quality for code search  (recommended)"
  },
  {
    value: "onnx-community/embeddinggemma-300m-ONNX",
    label: "embeddinggemma-300m",
    dim: 768,
    description: "768-dim \xB7 ~300MB \xB7 Google Gemma-based, multilingual, 2048-token context"
  },
  {
    value: "Xenova/all-MiniLM-L6-v2",
    label: "all-MiniLM-L6-v2",
    dim: 384,
    description: "384-dim \xB7 ~23MB  \xB7 Fast and lightweight, lower accuracy"
  },
  {
    value: "BAAI/bge-base-en-v1.5",
    label: "bge-base-en-v1.5",
    dim: 768,
    description: "768-dim \xB7 ~110MB \xB7 Strong general-purpose alternative to nomic"
  },
  {
    value: "__other__",
    label: "Other",
    dim: 768,
    description: "Enter a custom HuggingFace model ID and embedding dimension"
  }
];
async function promptConfigOptions(rl) {
  (0, import_prompts.printSection)("\u{1F50D}", "Semantic Search");
  const enableEmbeddings = await (0, import_prompts.askToggle)(
    rl,
    "Semantic embeddings (similarity search):",
    "Enables natural-language code search via vector embeddings. A local model (~130MB) is downloaded on first use."
  );
  const patch = { enableEmbeddings, useVecIndex: false, semanticEngine: "cosine", typesenseDashboard: false, qdrantDashboard: false, extractDocstrings: true, trackCallSites: true, enableArchitecture: false, cavemanMode: "off", shellCompressionLevel: "normal", enableMemory: false, enableDocs: false, docsContextLimit: 0 };
  if (enableEmbeddings) {
    const modelChoice = await (0, import_prompts.arrowSelect)(
      rl,
      "Embedding model:",
      PRESET_MODELS.map((m) => ({ value: m.value, label: m.label, description: m.description }))
    );
    let embeddingModel;
    let embeddingDim;
    if (modelChoice === "__other__") {
      console.log(`
  ${import_prompts.dim}Enter a HuggingFace model ID in the format org/model-name.${import_prompts.reset}`);
      while (true) {
        const raw = (await (0, import_prompts.ask)(rl, `  ${import_prompts.violet}Model identifier:${import_prompts.reset} `)).trim();
        if (raw.includes("/")) {
          embeddingModel = raw;
          break;
        }
        console.log(`  Expected a HuggingFace model ID in the format org/model-name (e.g. nomic-ai/nomic-embed-text-v1.5).`);
      }
      console.log(`
  ${import_prompts.dim}Enter the embedding output dimension for this model (check the model card on HuggingFace).${import_prompts.reset}`);
      while (true) {
        const raw = (await (0, import_prompts.ask)(rl, `  ${import_prompts.violet}Embedding dimension (e.g. 768, 384):${import_prompts.reset} `)).trim();
        const n = parseInt(raw, 10);
        if (!isNaN(n) && n > 0) {
          embeddingDim = n;
          break;
        }
        console.log(`  Expected a positive integer (e.g. 768, 384, 1536).`);
      }
    } else {
      const preset = PRESET_MODELS.find((m) => m.value === modelChoice);
      embeddingModel = preset.value;
      embeddingDim = preset.dim;
    }
    patch.embeddingModel = embeddingModel;
    patch.embeddingDim = embeddingDim;
    const semanticEngine = await (0, import_prompts.arrowSelect)(rl, "Vector search engine:", [
      { value: "cosine", label: "cosine", description: "In-process cosine similarity. No extra deps. Best for small/medium projects." },
      { value: "sqlite-vec", label: "sqlite-vec", description: "ANN index. Sub-linear search. Best for large codebases. Needs: better-sqlite3, sqlite-vec (native)." },
      { value: "orama", label: "orama", description: "Hybrid search (full-text + vector). Pure JS. Needs: @orama/orama, @orama/plugin-data-persistence." },
      { value: "pglite", label: "pglite", description: "Hybrid search via PostgreSQL + pgvector. Exact results. Pure WASM. Needs: @electric-sql/pglite." },
      { value: "lancedb", label: "lancedb", description: "ANN search via LanceDB (Apache Lance columnar format). Pure JS. Needs: @lancedb/lancedb." },
      { value: "qdrant", label: "qdrant", description: "ANN search via Qdrant embedded binary (HNSW index, Cosine). Needs: qdrant-local." },
      { value: "typesense", label: "typesense", description: "ANN search via Typesense (auto-downloaded binary, HNSW, Cosine). Needs: typesense." }
    ]);
    patch.semanticEngine = semanticEngine;
    patch.useVecIndex = semanticEngine === "sqlite-vec";
    if (semanticEngine === "typesense") {
      patch.typesenseDashboard = await (0, import_prompts.askToggle)(
        rl,
        "Typesense dashboard:",
        "Serves the Typesense Dashboard locally and opens it in your browser after indexing completes.",
        false
      );
    }
    if (semanticEngine === "qdrant") {
      patch.qdrantDashboard = await (0, import_prompts.askToggle)(
        rl,
        "Qdrant dashboard:",
        "Downloads the Qdrant Web UI (first time only) and opens it in your browser after indexing completes.",
        false
      );
    }
  }
  (0, import_prompts.printSection)("\u{1F4CA}", "Graph Features");
  patch.extractDocstrings = await (0, import_prompts.askToggle)(
    rl,
    "Docstring extraction:",
    "Enriches symbol metadata and improves context quality. Slightly increases indexing time."
  );
  patch.trackCallSites = await (0, import_prompts.askToggle)(
    rl,
    "Call site tracking (caller/callee graph):",
    "Enables kirograph_callers and kirograph_callees MCP tools. Increases index size."
  );
  patch.enableArchitecture = await (0, import_prompts.askToggle)(
    rl,
    "Architecture analysis (packages + layers):",
    "Detects packages from manifests and architectural layers. Enables kirograph_architecture, kirograph_coupling, kirograph_package.",
    false
  );
  (0, import_prompts.printSection)("\u{1F4D6}", "Documentation");
  patch.enableDocs = await (0, import_prompts.askToggle)(
    rl,
    "Documentation indexing (section-level retrieval):",
    "Indexes docs by heading structure. Enables kirograph_docs_toc, kirograph_docs_search, kirograph_docs_section, kirograph_docs_outline, kirograph_docs_refs.",
    false
  );
  if (patch.enableDocs) {
    const contextChoice = await (0, import_prompts.arrowSelect)(rl, "Include doc sections in kirograph_context results?", [
      { value: 0, label: "0 (disabled)", description: "Docs stay separate \u2014 use kirograph_docs_* tools explicitly (recommended)" },
      { value: 3, label: "3 sections", description: "Include up to 3 relevant doc sections in context results" },
      { value: 5, label: "5 sections", description: "Include up to 5 relevant doc sections in context results" },
      { value: 10, label: "10 sections", description: "Include up to 10 relevant doc sections in context results" }
    ]);
    patch.docsContextLimit = contextChoice;
  }
  (0, import_prompts.printSection)("\u{1F916}", "Agent Behavior");
  const cavemanChoice = await (0, import_prompts.arrowSelect)(rl, "Communication style (caveman mode):", [
    { value: "off", label: "off", description: "Normal responses \u2014 no compression" },
    { value: "lite", label: "lite", description: "Compact, no filler, full sentences" },
    { value: "full", label: "full", description: "Fragments, no articles, short synonyms" },
    { value: "ultra", label: "ultra", description: "Max compression, abbreviations, \u2192 for causality" }
  ]);
  patch.cavemanMode = cavemanChoice;
  const compressionChoice = await (0, import_prompts.arrowSelect)(rl, "Shell compression (kirograph_exec default level):", [
    { value: "off", label: "off", description: "No compression hook or steering (tool still available)" },
    { value: "normal", label: "normal", description: "Balanced: removes noise, keeps structure (recommended)" },
    { value: "aggressive", label: "aggressive", description: "More compact: groups by category, limits output" },
    { value: "ultra", label: "ultra", description: "Maximum compression: counts and summaries only" }
  ]);
  patch.shellCompressionLevel = compressionChoice;
  (0, import_prompts.printSection)("\u{1F9E0}", "Memory");
  patch.enableMemory = await (0, import_prompts.askToggle)(
    rl,
    "Persistent memory (cross-session observations):",
    "Stores decisions, errors, and patterns across sessions. Compressed (if caveman is on), linked to code symbols, searchable via kirograph_mem_* tools. Zero LLM tokens on write.",
    false
    // Requires explicit enable
  );
  return patch;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  DEFAULT_EMBEDDING_MODEL,
  promptConfigOptions
});
//# sourceMappingURL=config-prompt.js.map
