feat(desktop): author interaction prompts from the composer - #2
Open
kaykayyali wants to merge 3 commits into
Open
Conversation
Add an "Ask for a decision" composer action, gated by the Interaction cards experimental feature, that composes, signs and publishes a kind 40010 buttons, poll or form prompt into the open channel. This covers the "desktop /ask and /poll authoring" follow-up from the interaction slice without introducing a slash-command system. - `authoring.ts` builds the unsigned event and mirrors the relay's schema rules (identifier and label shape, per-type option and field counts, choice bounds, close rules, 30-day deadline, tag cap) so a person sees a precise message before signing instead of a relay rejection after. The relay stays authoritative; its own reason is shown if it still rejects. - `AskInteractionDialog` edits options (label, auto-derived editable ID, style for buttons), fields (label, ID, type, required, select choices), poll min/max, close rule, responder rule and deadline with labelled native controls; a failed attempt keeps the draft. - `AskInteractionButton` renders nothing unless the feature is on and is memoized into the channel composer's extra actions so the memoized composer does not re-render for a fresh element. Tests: node tests for the builder (default schemas, poll bounds, form fields and select choices, every relay rejection with its message, ID derivation); a Playwright spec proving the action is hidden when the feature is off, local validation blocks signing and keeps the draft, and buttons, poll and form events carry the expected tags. Validation: desktop typecheck, biome, file-size gate, node tests; `pnpm build:e2e` and the interactions and interaction-authoring smoke specs (15 passed). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtW2fxcYY2HkbKS6EpqqEV Signed-off-by: Claude <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2c9abc3a87
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…483-review-coverage-tlbi42-ask-authoring
…eptance - The authoring dialog is now opened for a specific channel: it publishes only to that channel, closes if the active channel changes underneath it, and its draft is keyed per channel so a question written for one channel is never signed into another. - The mock relay records every client-published EVENT and every OK it answers, and accepts a `rejectEventKinds` knob that refuses a kind with a restricted reason. The authoring spec now asserts on relay acceptance and the `h` tag of the published event rather than on signing alone, and adds a case where the relay refuses the prompt: the dialog stays open, shows the relay's reason, and keeps the draft. Validation: desktop typecheck, biome, node tests; `pnpm build:e2e` and the interactions and interaction-authoring smoke specs (16 passed). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PtW2fxcYY2HkbKS6EpqqEV Signed-off-by: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the "desktop
/askand/pollauthoring" follow-up listed indocs/experimental-interactions.mdfor block#7483. Stacked on #1 (the review fixes) so it can be merged after it.An Ask for a decision action appears in the channel composer toolbar when the Interaction cards experimental feature is on. It opens a dialog that composes a buttons, poll or form prompt (kind 40010), signs it with the desktop identity, and publishes it through the normal relay session. The relay's projection then renders as a card for aware clients and as text for everyone else, exactly like a CLI-authored prompt.
authoring.tsis a pure builder that mirrors the relay's schema rules (identifier and label shape, per-type option/field counts, choice bounds, close rules, 30-day deadline, tag cap) so people get an actionable message before signing. The relay stays authoritative; if it still rejects (for example the experiment is off on that relay) its reason is shown in the dialog.AskInteractionDialogedits options (label, auto-derived editable ID, style for buttons), fields (label, ID, type, required, comma-separated select choices), poll min/max, close rule, responder rule (members / admins / owners) and deadline presets. Every control is labelled; a failed attempt keeps the draft.AskInteractionButtonrenders nothing unless the feature is enabled and is memoized intoChannelPane's composer extra actions so the memoized composer keeps its render bailouts.Related issue
Refs block#7483, block#3261. Depends on #1.
Testing
authoring.test.mjs: default schemas, poll bounds and close rules, form fields with select choices, every relay rejection with its message, ID derivation and label rules.interaction-authoring.spec.ts(Playwright smoke, registered inplaywright.config.ts): the action is hidden when the feature is off; an empty question is refused without signing; a buttons request with an added option, quorum close, admin responders and a 3-day deadline is signed with the expected tags; a poll with an impossible max shows the message and keeps the draft, then publishes bounded multi-select; a form publishes typed fields andoptselvalues.pnpm typecheck,pnpm check,pnpm check:file-sizes;pnpm build:e2ethen both interaction specs: 15 passed.test-results/interaction-authoring.pngby the spec; not posted here becauseghis unavailable in this session.🤖 Generated with Claude Code
https://claude.ai/code/session_01PtW2fxcYY2HkbKS6EpqqEV
Generated by Claude Code