From 009d5705a59bcf86f3579a78e25c8b3fcd4cd476 Mon Sep 17 00:00:00 2001 From: t Date: Tue, 27 Oct 2026 16:25:43 -0600 Subject: Add panto-rsvp: RSVP reading mode for assistant text Standalone opt-in extension that plays the latest assistant text block one word at a time above the input, using the core mount, input-mode and highlight("markdown") APIs settled in pantograph's rsvp-extension-plan. Registers /rsvp; users bind it via "ctrl+s" = "/rsvp" under [keys]. Player and config logic are pure Lua with an assert-based self-check run against a host/timer stub, since the core APIs land separately. --- rsvp/config.lua | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 rsvp/config.lua (limited to 'rsvp/config.lua') diff --git a/rsvp/config.lua b/rsvp/config.lua new file mode 100644 index 0000000..fb4b8fa --- /dev/null +++ b/rsvp/config.lua @@ -0,0 +1,41 @@ +local M = {} + +M.DEFAULT_WPM = 250 +M.DEFAULT_STEP = 25 +M.DEFAULT_MIN_WPM = 50 + +local function positive_finite(value) + return type(value) == "number" + and value == value + and value ~= math.huge + and value ~= -math.huge + and value > 0 +end + +function M.read(raw) + if raw == nil then raw = {} end + if type(raw) ~= "table" then + return nil, "rsvp settings must be a table" + end + + for key in pairs(raw) do + if key ~= "wpm" and key ~= "wpm_step" and key ~= "min_wpm" then + return nil, string.format("unknown rsvp setting %s", tostring(key)) + end + end + + local settings = { + wpm = raw.wpm == nil and M.DEFAULT_WPM or raw.wpm, + wpm_step = raw.wpm_step == nil and M.DEFAULT_STEP or raw.wpm_step, + min_wpm = raw.min_wpm == nil and M.DEFAULT_MIN_WPM or raw.min_wpm, + } + for key, value in pairs(settings) do + if not positive_finite(value) then + return nil, string.format("rsvp.%s must be a finite positive number", key) + end + end + settings.wpm = math.max(settings.wpm, settings.min_wpm) + return settings +end + +return M -- cgit v1.3