mirror of
https://github.com/qwibitai/nanoclaw.git
synced 2026-06-04 10:14:47 +08:00
setup: add ← Back option to Discord, WhatsApp, iMessage channel flows
Picking the wrong messaging channel during setup left users with no way to bail out — they had to either complete the chosen flow or kill setup and start over. This adds a Back option to the first prompt of three channel sub-flows that share the same simple shape (one leading brightSelect that's easy to extend). Mechanics: - New `setup/lib/back-nav.ts` exports a BACK_TO_CHANNEL_SELECTION sentinel and ChannelFlowResult type. - `setup/auto.ts` wraps the channel dispatch in a while-loop; channels return BACK_TO_CHANNEL_SELECTION to bounce back to the chooser without restarting setup. Channels not yet wired return void and the loop exits after one pass, so the change is backwards compatible. - Discord, WhatsApp, iMessage each add a `← Back to channel selection` option to their first prompt. Telegram, Slack, Teams, and Signal will follow as separate PRs — they each need a slightly different shape (extra prompt insertions, gating inside multi-step flows, etc.) and are easier to review independently. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Channel-flow back-navigation sentinel.
|
||||
*
|
||||
* Each `runXxxChannel(displayName)` in `setup/channels/` may return either
|
||||
* `void` (sub-flow completed normally) or `BACK_TO_CHANNEL_SELECTION` to
|
||||
* signal "the user picked '← Back to channel selection' on my first
|
||||
* prompt; please re-run the channel chooser." `setup/auto.ts` catches
|
||||
* that signal and loops back to `askChannelChoice()`.
|
||||
*
|
||||
* Back is only offered on the *first* interactive prompt of each channel
|
||||
* sub-flow — once the user has answered something, they're committed
|
||||
* (subsequent steps may have side effects like opening browsers, hitting
|
||||
* APIs, or installing adapter packages, none of which are easily undone).
|
||||
*/
|
||||
export const BACK_TO_CHANNEL_SELECTION = Symbol('BACK_TO_CHANNEL_SELECTION');
|
||||
|
||||
export type ChannelFlowResult = void | typeof BACK_TO_CHANNEL_SELECTION;
|
||||
Reference in New Issue
Block a user