(input)
| 202 | const dimensions = classifyComplexity(input, matches); |
| 203 | if (matches.length === 1) { |
| 204 | const selected = matches[0].route; |
| 205 | const reason = `one keyword group produced ${matches[0].route} as a candidate: ${matches[0].matches.join(', ')}.`; |
| 206 | |
| 207 | return semanticDecision({ |
| 208 | mode, |
| 209 | tier: 2, |
| 210 | suggestedRoute: selected, |
| 211 | reason: `${reason} This is candidate evidence; semantic classification must confirm the route.`, |
| 212 | resolver: 'semantic-candidate', |
| 213 | candidates: candidateList(matches), |
| 214 | confidence: 'candidate', |
| 215 | alternatives: alternativesFor(input, matches), |
| 216 | verification: verificationFor(selected), |
| 217 | dimensions, |
| 218 | }); |
| 219 | } |
| 220 | |
| 221 | if (matches.length > 1) { |
| 222 | const explicit = explicitIntentRoute(input, matches); |
| 223 | if (explicit) { |
| 224 | return semanticDecision({ |
| 225 | mode, |
| 226 | tier: 2, |
| 227 | suggestedRoute: explicit.route, |
| 228 | reason: `${explicit.reason} This is candidate evidence; semantic classification must confirm the route.`, |
| 229 | resolver: 'semantic-candidate', |
| 230 | candidates: candidateList(matches), |
| 231 | confidence: 'candidate', |
| 232 | alternatives: alternativesFor(input, matches), |
| 233 | verification: verificationFor(explicit.route), |
| 234 | dimensions, |
| 235 | }); |
| 236 | } |
| 237 | |
| 238 | return semanticDecision({ |
| 239 | mode, |
| 240 | tier: 3, |
| 241 | suggestedRoute: '/marshal', |
| 242 | reason: `multiple route families matched (${matches.slice(0, 3).map((item) => item.route).join(', ')}), so Marshal should sequence the work before escalating.`, |
| 243 | resolver: 'semantic-candidate', |
| 244 | candidates: candidateList(matches), |
| 245 | confidence: 'candidate', |
| 246 | alternatives: alternativesFor(input, matches), |
| 247 | verification: verificationFor('/marshal'), |
| 248 | dimensions, |
| 249 | }); |
| 250 | } |
| 251 | |
| 252 | let selected = fallbackRoute(dimensions); |
| 253 | let reason = fallbackReason(selected, dimensions); |
| 254 | const proportional = applyProportionality(input, selected, dimensions); |
| 255 | selected = proportional.selected; |
| 256 | if (proportional.reason) reason = proportional.reason; |
| 257 | |
| 258 | return semanticDecision({ |
| 259 | mode, |
| 260 | tier: 3, |
| 261 | suggestedRoute: selected, |
no test coverage detected