Files
nanoclaw/setup/lib/role-prompt.ts
gavrielc 56ef5b4461 feat(setup): clarify setup flow from user-feedback session
- Container step: duration hint + 3-line rolling output window with
  60s stall detector that offers "keep waiting" vs "ask Claude"
- First chat: reframed as a try-out with sandbox-model explainer
  (wakes on message, sleeps when idle, context persists)
- Timezone: auto-detected non-UTC zones now get an explicit
  confirm from the user instead of silent persist
- Outro: added always-on warning + prominent "check your DM" banner
  when a channel was configured; directive last line
- Discord: always show token-location reminder even when user says
  they have one; new "do you have a server?" branch walks through
  server creation if not
- All select prompts: custom brightSelect renderer keeps inactive
  option labels at full brightness (was dim gray); adds @clack/core
  as a direct dep

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-23 10:35:12 +03:00

44 lines
1.3 KiB
TypeScript

/**
* Shared "who's connecting this channel?" prompt used by the channel setup
* drivers before they hand off to scripts/init-first-agent.ts.
*
* Default: owner. Self-hosted NanoClaw is almost always a single-operator
* deployment, and granting the same human owner status on every channel
* they wire up matches what you'd want 99% of the time. The prompt
* surfaces admin/member for the edge cases (shared instance, collaborators
* with limited access), but hitting Enter assigns owner.
*/
import { brightSelect } from './bright-select.js';
import { ensureAnswer } from './runner.js';
export type OperatorRole = 'owner' | 'admin' | 'member';
export async function askOperatorRole(
channelLabel: string,
): Promise<OperatorRole> {
const choice = ensureAnswer(
await brightSelect<OperatorRole>({
message: `How should this ${channelLabel} account be registered?`,
initialValue: 'owner',
options: [
{
value: 'owner',
label: 'Owner',
hint: 'full access — recommended for your own account',
},
{
value: 'admin',
label: 'Admin',
hint: 'can manage the agent for this channel',
},
{
value: 'member',
label: 'Member',
hint: 'can chat with the agent but nothing more',
},
],
}),
);
return choice;
}