intentResponses.ts
1 // Copyright (c) 2026 VPL Solutions. All rights reserved. 2 // Licensed under the MIT License. See LICENSE for details. 3 4 export type IntentKey = 'evaluate' | 'build' | 'test-local' | 'explore'; 5 export type TopologyKey = 'cloud' | 'hybrid' | 'on-prem'; 6 7 export interface IntentOption { 8 key: IntentKey; 9 label: string; 10 } 11 12 export interface TopologyOption { 13 key: TopologyKey; 14 label: string; 15 } 16 17 export const INTENT_OPTIONS: IntentOption[] = [ 18 { key: 'evaluate', label: 'Evaluate retrieval behavior' }, 19 { key: 'build', label: 'Build a production system' }, 20 { key: 'test-local', label: 'Test locally (on-prem / private)' }, 21 { key: 'explore', label: 'Explore capabilities' }, 22 ]; 23 24 export const TOPOLOGY_OPTIONS: TopologyOption[] = [ 25 { key: 'cloud', label: 'Cloud' }, 26 { key: 'hybrid', label: 'Hybrid' }, 27 { key: 'on-prem', label: 'On-prem' }, 28 ]; 29 30 const RESPONSES: Record<string, string> = { 31 'evaluate|cloud': 32 'Cloud deployments include managed guardrails, but retrieval thresholds and confidence gating are still configured in Meridian. The Evaluation page logs every decision for review.', 33 'evaluate|hybrid': 34 'Hybrid environments split retrieval across cloud and on-prem stores. Confidence thresholds apply uniformly — review behavior differences in the Evaluation page.', 35 'evaluate|on-prem': 36 'In on-prem environments, execution control and retrieval validation become more important since there are no managed guardrails. Tune thresholds before connecting production data.', 37 'build|cloud': 38 'Cloud deployments rely on Azure managed services for guardrails and scaling. Retrieval thresholds and audit trails are still configured in Meridian — the platform does not manage them automatically.', 39 'build|hybrid': 40 'Hybrid deployments require consistent governance across cloud and on-prem retrieval. Confidence gating and refusal behavior apply at the Meridian layer, not the infrastructure layer.', 41 'build|on-prem': 42 'On-prem production systems own their entire retrieval stack. Confidence thresholds, refusal behavior, and audit trails must be configured before going live.', 43 'test-local|cloud': 44 'Local testing against cloud backends still enforces retrieval thresholds. Use the Settings page to configure provider endpoints and verify behavior before deploying.', 45 'test-local|hybrid': 46 'Local testing in hybrid mode lets you validate retrieval across both cloud and on-prem stores. Confidence scores and refusal behavior are consistent regardless of the store.', 47 'test-local|on-prem': 48 'Local and on-prem deployments control their own retrieval stack. Confidence thresholds and refusal behavior should be tuned before connecting any production data.', 49 'explore|cloud': 50 'Confidence scores, refusal behavior, and retrieval thresholds are all visible in the Query console. The Evaluation page logs every decision for review.', 51 'explore|hybrid': 52 'Confidence scores, refusal behavior, and retrieval thresholds are all visible in the Query console. The Evaluation page logs every decision for review.', 53 'explore|on-prem': 54 'Confidence scores, refusal behavior, and retrieval thresholds are all visible in the Query console. The Evaluation page logs every decision for review.', 55 }; 56 57 const FALLBACK = 58 'Meridian adapts to your deployment topology. Retrieval confidence, refusal behavior, and audit trails are configurable in Settings.'; 59 60 export function getIntentResponse(intent: IntentKey, topology: TopologyKey): string { 61 return RESPONSES[`${intent}|${topology}`] ?? FALLBACK; 62 } 63 64 export interface IntentProbeRecord { 65 intent: IntentKey; 66 topology: TopologyKey; 67 completedAt: string; 68 } 69 70 const STORAGE_KEY = 'meridian-intent-probe'; 71 72 export function getStoredProbe(): IntentProbeRecord | null { 73 try { 74 const raw = localStorage.getItem(STORAGE_KEY); 75 return raw ? (JSON.parse(raw) as IntentProbeRecord) : null; 76 } catch { 77 return null; 78 } 79 } 80 81 export function storeProbeResult(intent: IntentKey, topology: TopologyKey): void { 82 const record: IntentProbeRecord = { 83 intent, 84 topology, 85 completedAt: new Date().toISOString(), 86 }; 87 localStorage.setItem(STORAGE_KEY, JSON.stringify(record)); 88 } 89 90 export function markProbeSkipped(): void { 91 localStorage.setItem(STORAGE_KEY, JSON.stringify({ skipped: true })); 92 }