{
  "version": 3,
  "sources": ["../../src/app/ai/agents/evals2/scenarios/images/cmsImageAttributes.eval.ts"],
  "sourcesContent": ["import { assert } from \"@framerjs/shared\"\nimport { agentEvalAsset } from \"../../harness/asset.ts\"\nimport { createEvalExportZipFixture } from \"../../harness/fixture.ts\"\nimport { getKeywordMatchCount, getNormalizedCmsImageAltText } from \"./helpers.ts\"\n\ninterface ExpectedCmsImageAltText {\n\titemId: string\n\tlabel: string\n\tkeywords: readonly string[]\n}\n\nconst id = \"cms-image-attributes\"\nconst requestId = \"LUEBay1ze\"\nconst imageFieldId = \"JMkjIJVzx\"\nconst minimumKeywordMatches = 2\n\nconst expectedImageAltTexts: readonly ExpectedCmsImageAltText[] = [\n\t{\n\t\titemId: \"GPeAL20P3\",\n\t\tlabel: \"solar innovation post image\",\n\t\tkeywords: [\"aerial\", \"above\", \"solar\", \"farm\", \"panels\", \"grass\", \"crop\"],\n\t},\n\t{\n\t\titemId: \"VqXCgJhLL\",\n\t\tlabel: \"wind revolution post image\",\n\t\tkeywords: [\"wind\", \"turbine\", \"field\", \"hill\", \"sky\", \"sunset\", \"sunrise\"],\n\t},\n\t{\n\t\titemId: \"KcP6_QrLr\",\n\t\tlabel: \"forests infrastructure post image\",\n\t\tkeywords: [\"forest\", \"tree\", \"green\", \"wood\", \"undergrowth\", \"sun\"],\n\t},\n\t{\n\t\titemId: \"aAZjs9Vxa\",\n\t\tlabel: \"cities post solar image\",\n\t\tkeywords: [\"solar\", \"panel\", \"field\", \"meadow\", \"countryside\", \"blue\", \"sky\"],\n\t},\n]\n\n/**\n * Prompt: `Add alt texts to the images in the posts describing the content`\n * Project: A newspaper website with 4 articles using CMS.\n */\nevaluation(\n\t\"CMS Image Attributes: Adds Alt Text\",\n\tcreateEvalExportZipFixture(id, agentEvalAsset(\"cmsImageAttributes.fixture.zip\"), {\n\t\truntimeTarget: \"cli\",\n\t}),\n\t{\n\t\tid,\n\t\trequestId,\n\t\tmaxSteps: 5,\n\t\tstopWhenPassed: true,\n\t},\n\t({ engine, report, tools }) => {\n\t\ttools.reportReplayChecks(report, { requestId })\n\n\t\treport.accuracy.each(\n\t\t\t`CMS image alt text includes at least ${minimumKeywordMatches} expected keywords`,\n\t\t\texpectedImageAltTexts.map(image => image.label),\n\t\t\tlabel => {\n\t\t\t\tconst image = expectedImageAltTexts.find(expectedImage => expectedImage.label === label)\n\t\t\t\tassert(image, `Expected '${label}' to match a CMS image alt text scenario.`)\n\t\t\t\tconst altText = getNormalizedCmsImageAltText(engine, image.itemId, imageFieldId)\n\t\t\t\tconst keywordMatchCount = getKeywordMatchCount(altText, image.keywords)\n\t\t\t\t// Assert instead of expect to log the generated alt text in the error message.\n\t\t\t\tassert(\n\t\t\t\t\tkeywordMatchCount >= minimumKeywordMatches,\n\t\t\t\t\t`Expected '${label}' alt text to include at least ${minimumKeywordMatches} keywords, received '${altText}'.`,\n\t\t\t\t)\n\t\t\t},\n\t\t)\n\t},\n)\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,IAAM,KAAK;AACX,IAAM,YAAY;AAClB,IAAM,eAAe;AACrB,IAAM,wBAAwB;AAE9B,IAAM,wBAA4D;AAAA,EACjE;AAAA,IACC,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,UAAU,CAAC,UAAU,SAAS,SAAS,QAAQ,UAAU,SAAS,MAAM;AAAA,EACzE;AAAA,EACA;AAAA,IACC,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,UAAU,CAAC,QAAQ,WAAW,SAAS,QAAQ,OAAO,UAAU,SAAS;AAAA,EAC1E;AAAA,EACA;AAAA,IACC,QAAQ;AAAA,IACR,OAAO;AAAA,IACP,UAAU,CAAC,UAAU,QAAQ,SAAS,QAAQ,eAAe,KAAK;AAAA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