discord implementation
Runtime ownership
lib/adapter.mjs owns the gateway connection, heartbeat acknowledgements, resume/reconnect state and inbound turns. Its existing transport methods remain the entry points used by platform tools and live message delivery.
lib/interactions.mjs owns slash registration, named slash-command and component handlers, picker pages and interaction settings writes. The common interaction entry checks guild membership, the configured guild and current role-policy access before dispatch; picker submissions still re-check operator access and current model capabilities. Shared command, display and model rules come from the host package.
lib/askFlow.mjs owns posting, paging, answer commitment, sender-bound free-text capture and retirement of parked questions. It mutates the adapter's single pending-question map; core ask_resolved events remain the only timeout authority. The final answer is committed and removed synchronously before a response is posted, so competing last answers reach core only once.
lib/rest.mjs owns JSON requests and the single multipart attachment transport. Images and shared files keep their MIME-by-name callbacks and existing argument order. Speech uses that same uploader with its returned per-file MIME and the distinct audio error label. Both request types retain bot authorization and at most three retries after HTTP 429, using the response's retry-after delay.