// src/eval/index.ts
import { verifyCompletion, extractProducedState, weightedComposite, createLlmCorrectnessChecker } from "@tangle-network/agent-eval";
function producedFromToolEvents(events) {
  return events.map(
    (e) => e.type === "proposal_created" ? { type: "proposal_created", proposalId: e.proposalId, title: e.title, status: e.status, content: e.content } : { type: "artifact", artifactId: `vault:${e.path}`, name: e.path, uri: `vault://${e.path}`, mimeType: "text/markdown", content: e.content }
  );
}
var STOPWORDS = /* @__PURE__ */ new Set(["the", "a", "an", "and", "or", "for", "to", "of", "in", "on", "with", "review", "update", "new", "proposed"]);
function createTokenRecallChecker(opts = {}) {
  const minRecall = opts.minRecall ?? 0.5;
  const minLen = opts.minContentLength ?? 120;
  return async (requirement, content) => {
    const body = content.trim();
    if (body.length < minLen) return { correct: false, reason: `content too thin (${body.length} chars) to be the deliverable` };
    const tokens = requirement.title.toLowerCase().split(/[^a-z0-9]+/).filter((t) => t.length > 2 && !STOPWORDS.has(t));
    if (tokens.length === 0) return { correct: true, reason: "requirement title has no significant tokens \u2014 structural match accepted" };
    const lower = body.toLowerCase();
    const hits = tokens.filter((t) => lower.includes(t)).length;
    const recall = hits / tokens.length;
    return recall >= minRecall ? { correct: true, reason: `content recalls ${hits}/${tokens.length} requirement tokens` } : { correct: false, reason: `content recalls only ${hits}/${tokens.length} requirement tokens` };
  };
}

export {
  producedFromToolEvents,
  createTokenRecallChecker,
  verifyCompletion,
  extractProducedState,
  weightedComposite,
  createLlmCorrectnessChecker
};
//# sourceMappingURL=chunk-FA4XR66Y.js.map