/** Entirely invented products, prices and evidence. Not an employer catalog. */ import type { Input, Product, Route, Source } from "./grounded-answer"; export const catalog: readonly Product[] = [ { id: "lumen-one", name: "Lumen One", aliases: ["LM-1", "Lumen"] }, { id: "lumen-one-pro", name: "Lumen One Pro", aliases: ["LM-1 Pro", "Lumen"] }, { id: "lumen-arc", name: "Lumen Arc", aliases: ["LM-A", "Lumen"] }, ]; export const evidence: readonly Source[] = [ { id: "one-us-v1", productId: "lumen-one", region: "us", published: true, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "USD 240", connection: "USB-C", mounting: "Table stand" } }, { id: "pro-us-v1", productId: "lumen-one-pro", region: "us", published: true, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "USD 360", connection: "USB-C and Wi-Fi", mounting: "Tripod" } }, { id: "arc-us-v1", productId: "lumen-arc", region: "us", published: true, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "USD 300", connection: "Wi-Fi", mounting: "Wall bracket" } }, { id: "one-cn-v1", productId: "lumen-one", region: "cn", published: true, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "CNY 1700", connection: "USB-C", mounting: "Table stand" } }, { id: "one-expired", productId: "lumen-one", region: "us", published: true, validFrom: "2026-09-01T00:00:00Z", expiresAt: "2026-10-01T00:00:00Z", facts: { price: "USD 190", connection: "Legacy USB" } }, { id: "one-draft", productId: "lumen-one", region: "us", published: false, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "USD 99", connection: "Unreviewed wireless" } }, { id: "one-conflict", productId: "lumen-one", region: "us", published: true, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "USD 270", connection: "USB-C" } }, { id: "one-disabled", productId: "lumen-one", region: "us", published: true, disabled: true, validFrom: "2026-10-01T00:00:00Z", expiresAt: "2026-11-01T00:00:00Z", facts: { price: "USD 5", connection: "Disabled offer" } }, { id: "one-future", productId: "lumen-one", region: "us", published: true, validFrom: "2026-11-01T00:00:00Z", expiresAt: "2026-12-01T00:00:00Z", facts: { price: "USD 250", connection: "USB-C" } }, ]; export const baseInput: Input = { message: "What is the price of Lumen One?", intent: "fact", field: "price", region: "us", now: "2026-10-21T12:00:00Z", previousProductIds: [], providerAvailable: true, }; export type Scenario = { id: string; name: string; description: string; input: Input; sourceIds: readonly string[]; expected: Route; expectedReason: string }; const allIds = evidence.filter(source => source.id !== "one-conflict").map(source => source.id); export const scenarios: readonly Scenario[] = [ { id: "exact-fact", name: "A grounded fact", description: "Exact product, fresh published regional source.", input: baseInput, sourceIds: allIds, expected: "deterministic-answer", expectedReason: "verified-fact" }, { id: "similar-model", name: "Similar model names", description: "One Pro must not silently become One.", input: { ...baseInput, message: "Price of Lumen One Pro?" }, sourceIds: allIds, expected: "deterministic-answer", expectedReason: "verified-fact" }, { id: "ambiguous", name: "An ambiguous family", description: "Lumen identifies three products. Ask for clarification.", input: { ...baseInput, message: "How much is Lumen?" }, sourceIds: allIds, expected: "safe-fallback", expectedReason: "ambiguous-product-name" }, { id: "two-turns", name: "Compare across turns", description: "A saved One selection plus an explicit Arc mention.", input: { ...baseInput, message: "Compare it with Lumen Arc", intent: "compare", previousProductIds: ["lumen-one"] }, sourceIds: allIds, expected: "deterministic-answer", expectedReason: "verified-comparison" }, { id: "model-boundary", name: "An eligible explanation", description: "Build an evidence-only request, without calling a model.", input: { ...baseInput, message: "Explain the connection of Lumen One", intent: "explain", field: "connection" }, sourceIds: allIds, expected: "model-request", expectedReason: "eligible-model-request" }, { id: "forged", name: "A forged citation", description: "A simulated provider supplies a source that does not exist.", input: { ...baseInput, intent: "explain", simulatedResponse: { claims: [{ productId: "lumen-one", field: "price", value: "USD 240", citationId: "forged-source" }] } }, sourceIds: allIds, expected: "safe-fallback", expectedReason: "invalid-simulated-citations" }, { id: "unavailable", name: "Provider unavailable", description: "An eligible source does not make an unavailable provider healthy.", input: { ...baseInput, intent: "explain", providerAvailable: false }, sourceIds: allIds, expected: "safe-fallback", expectedReason: "provider-unavailable" }, { id: "conflict", name: "Conflicting sources", description: "Two eligible sources disagree; do not pick an arbitrary fact.", input: baseInput, sourceIds: ["one-us-v1", "one-conflict"], expected: "safe-fallback", expectedReason: "conflicting-evidence" }, { id: "no-evidence", name: "No evidence", description: "A catalog match alone is not an answer source.", input: baseInput, sourceIds: [], expected: "safe-fallback", expectedReason: "no-eligible-evidence" }, { id: "ineligible", name: "Only rejected evidence", description: "Expired, draft, wrong-region and future records must all stay out.", input: baseInput, sourceIds: ["one-expired", "one-draft", "one-cn-v1", "one-future"], expected: "safe-fallback", expectedReason: "no-eligible-evidence" }, ];