feat(engine): wire verb-target-prep — explicit \light X with Y\ and \use\ routing

light X with Y validates the named instrument and reuses handleLight.
use X / use X on Y route through the encounter dispatcher; if no encounter
consumes it, the dispatcher narrates the fallback. The encounter matcher
also rejects transitions whose required item doesn't match the typed
instrument, so a mistyped instrument fails cleanly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-05-09 14:22:03 -05:00
parent 8401e7d281
commit b870d884ef
3 changed files with 99 additions and 1 deletions
+7 -1
View File
@@ -66,12 +66,17 @@ export function applyVerbToEncounter(
const phaseDef = def.phases[currentPhase]
if (!phaseDef) return null
// Only verb-target and verb-only commands engage with encounters.
// Only verb-target, verb-target-prep, and verb-only commands engage with encounters.
let verb: string | null = null
let targetId: string | null = null
let instrumentId: string | null = null
if (command.kind === 'verb-target') {
verb = command.verb
targetId = command.target.canonical
} else if (command.kind === 'verb-target-prep') {
verb = command.verb
targetId = command.target.canonical
instrumentId = command.indirect.canonical
} else if (command.kind === 'verb-only' && command.verb !== 'inventory') {
verb = command.verb
} else {
@@ -91,6 +96,7 @@ export function applyVerbToEncounter(
}
}
}
if (t.requires && instrumentId && t.requires.item !== instrumentId) return false
return true
})