Migrate NPC dialogue to a replaceable Lua UI package
Implement approved NPC conversation migration: one prk.npc-chat provider for transcript, answers, Desc/Info/Give/Shop bar and hand-over panel. Preserve npcchat_window identity, revisioned ClientKnubotState and native server-driven lifecycle, packet policy, inventory restoration, drops, tooltips, credits and physical activation. Lua owns composition and presentation. Reuse core.window/core.icon_grid, typed adapters and provider fallback; add bounded shared rich-text/attached-panel capabilities only where needed. No commits unless requested. Implementation is on feature/lua-npc-dialogue in the original clean checkout. Implemented package/provider and typed native adapter, shared bounded AOML rendering and native attached-panel placement/visibility/group stacking. Removed legacy presenter and global dialogue layouts. Native snapshots now identify conversation and hand-over generations; state commands optionally validate captured context atomically. Source-linked AOT acceptance drives real ClientKnubotState messages and native input through combat answers, stale question replacement, current-cash acceptance, failure-close and unresolved-item restoration. Verified milestone: old presenter failed stale held-response regression (expected zero answers, got one). Current focused dialogue/state tests passed; first full client suite 4437 passed/188 skipped, graphics 719 passed/1 skipped. Native Lua runner passed Release and ASan/UBSan tests, generator self-tests and both Native AOT acceptances including dialogue. New GPU wrapping/scroll tests pass on installed GUI assets; inspected dialogue/turn-in screenshots at /tmp/prk-npc-screens. Fixture font lifetime corrected to keep layout fonts alive through GPU render. Mutation checks now verified: removing native answer/question validation, context rebinding, current-cash capping, trade-context rebinding, state-level captured-context guards, Lua transcript/answer/item projection and hand-over credit reset each causes its targeted regression to fail. Mutations restored. Docs updated and obsolete native NPC color constants removed. Static feature review found one high-severity pre-existing AOML parser issue newly exposed by ui.aoml: repeated malformed '<' candidates rescan the remaining suffix outside Lua's instruction budget. Two adversarial regressions (131072 '<' characters with/without a final '>') each timed out at two seconds before the fix. Reworked tag scanning to consume failed candidates without suffix rescans, plus constant-time inherited color lookup and indexed/amortized block closing; all 68 focused parser/dialogue/state tests passed afterward. An additional state regression proved an answer captured before a server hand-over could still send during that hand-over; state-level answer validation now refuses it. Follow-up review found a remaining quadratic Break helper (string LastOrDefault enumerated a large preceding paragraph for repeated empty blocks), plus editable-widget rich-text accounting bypass. Reproduced both before fixing: large paragraph/empty-block test timed out at two seconds, and real native editor deletion retained TextRuns after releasing its charge. Break now reads the final character by index; ui.aoml accepts only noneditable TextViews. Both regressions pass. All reported static findings have source fixes and red-green evidence; no claim of an independent clean follow-up review. Final validation against restored, finished source: complete client suite 4444 passed/188 environment-dependent skips/0 failed; graphics 719 passed/1 skipped/0 failed; 152 focused installed-asset dialogue/parser/chat/book/shared-capability checks passed with zero skips. Client warning-gated build passed with zero warnings/errors, including after normal local restores following Docker. Native Lua Release and ASan/UBSan suites each passed 8/8; generator self-tests and both Native AOT executables passed, including actual dialogue adapter/state/input and allocation-free unchanged updates. Lua formatting/syntax and git diff --check pass. No stale legacy presenter/layout/native color references remain. Installed-skin GPU dialogue/turn-in screenshots inspected at /tmp/prk-npc-screens. Committed as 5395403d6 (feature: Migrate NPC dialogue to a replaceable Lua UI package) and pushed to origin/feature/lua-npc-dialogue. User manually verified the implementation and reported that it works well; no detailed scenario/platform breakdown was supplied. Agent-run live-server interaction and native Windows/macOS execution were not performed. Pull request #2953: https://git.project-rk.com/prk/engines/pulls/2953 (feature/lua-npc-dialogue → develop), open and not draft. Complete comparison contains only this session's migration and directly required shared support/parser hardening. Working tree clean at publication. Acceptance: production uses Lua without parallel native presentation; preserve transcript/AOML/grouping/wrapping/autoscroll, answers/waiting, vendor/trade controls, turn-in slots/credits/drop behavior and attached-panel placement/stack/hide; captured actions cannot change targets on server/NPC replacement; commands remain validated and usable in combat; close/failure/teardown preserves native policy. Red-green behavior regressions, relevant client/graphics/Lua/AOT validation; live/platform gaps explicit.
Checklist
2 of 2 complete- Implement package/provider and native validated adapter with reusable rich-text/attachment support; retire legacy presentation.
- Verify player-visible behavior and stale-input/credit/lifecycle regressions red-green; run relevant suites and record validation limitations.
- Area
- Project Rubi-Ka
- Project
- engines
- Kind
- Feature
- Task ID
tsk_n9u677gdw6- Updated