Your own team of AI bots in one self-hosted binary: spaces, every account you have, handoffs, approvals and routines. Open-source, self-hosted alternative to Grok Bot, Claude Duet and OpenAI dots. Rust + React.
Rust ai-agentsai-assistantai-botautomationbotbots-teamchatbotclaude-duetgrokgrok-botgrok-bot-alternativeharnessllmmulti-agentopenai-dotsopenbotpersonal-agentrustself-hostedselfhosted-ai
Suggested prompts: match whole job titles, a third teammate, no wrong-field guesses
Pixel (kwant bot)c38f58f60852
diff --git a/frontend/src/components/ChatView.tsx b/frontend/src/components/ChatView.tsxindex 126813f5..59f163b7 100644--- a/frontend/src/components/ChatView.tsx+++ b/frontend/src/components/ChatView.tsx@@ -39,6 +39,34 @@ import { routeReasonText } from '../routeReason';import { InterruptedNotice, SystemNotice } from './SystemNotice';import { isSystemNotice, parseInterruption, retryTargets } from '../interruptions';+/** A swipeable chip row whose right fade edge (phones only, see .kw-scroll-row) goes away once+ * it is scrolled to the end, or when everything already fits. */+function ScrollRow({ children, ...rest }: React.HTMLAttributes<HTMLDivElement>) {+ const ref = useRef<HTMLDivElement>(null);+ const update = () => {+ const el = ref.current;+ if (el) el.dataset.atEnd = String(el.scrollLeft + el.clientWidth >= el.scrollWidth - 1);+ };+ useEffect(() => {+ const el = ref.current;+ if (!el) return;+ el.addEventListener('scroll', update, { passive: true });+ const resize = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(update);+ resize?.observe(el);+ return () => {+ el.removeEventListener('scroll', update);+ resize?.disconnect();+ };+ }, []);+ // The chips themselves can change without the row resizing.+ useEffect(update);+ return (+ <div ref={ref} {...rest}>+ {children}+ </div>+ );+}+export interface ChatMessage {id: string;sender_role: 'user' | 'kwant' | 'system';@@ -1201,7 +1229,7 @@ export const ChatView: React.FC<ChatViewProps> = ({{/* Suggested prompts for who is in this chat: one swipeable row on phones */}{messages.length <= 1 && suggestions.length > 0 && (- <div+ <ScrollRowclassName="kw-scroll-row px-3 sm:px-6 py-2 flex flex-nowrap sm:flex-wrap items-center gap-2 overflow-x-auto sm:overflow-visible select-none"role="group"aria-label="Suggested prompts"@@ -1217,13 +1245,13 @@ export const ChatView: React.FC<ChatViewProps> = ({{prompt}</button>))}- </div>+ </ScrollRow>)}{/* Modern Composer Input Bar */}<div className="px-3 pt-3 pb-[max(0.75rem,env(safe-area-inset-bottom))] sm:p-4 border-t border-zinc-800/80 bg-zinc-900/30">{teamMembers && teamMembers.length > 0 && (- <div className="kw-scroll-row max-w-4xl mx-auto mb-2.5 flex items-center gap-1.5 overflow-x-auto text-xs select-none" role="group" aria-label="Ask a member">+ <ScrollRow className="kw-scroll-row max-w-4xl mx-auto mb-2.5 flex items-center gap-1.5 overflow-x-auto text-xs select-none" role="group" aria-label="Ask a member"><span className="shrink-0 text-[11px] font-medium text-zinc-500 whitespace-nowrap">Ask:</span>{teamMembers.map((m) => (<button@@ -1248,7 +1276,7 @@ export const ChatView: React.FC<ChatViewProps> = ({<span>@{teamName} (Team)</span></button>)}- </div>+ </ScrollRow>)}{viewingHistory && (diff --git a/frontend/src/styles/modern.css b/frontend/src/styles/modern.cssindex bada18c8..6bac2e65 100644--- a/frontend/src/styles/modern.css+++ b/frontend/src/styles/modern.css@@ -185,6 +185,10 @@.kw-scroll-row::-webkit-scrollbar {display: none;}+ .kw-scroll-row[data-at-end='true'] {+ mask-image: none;+ -webkit-mask-image: none;+ }.kw-head-btn:not([aria-pressed='true']) {background-color: transparent;border-color: transparent;diff --git a/frontend/src/suggestedPrompts.ts b/frontend/src/suggestedPrompts.tsindex 6b5ac973..6665a132 100644--- a/frontend/src/suggestedPrompts.ts+++ b/frontend/src/suggestedPrompts.ts@@ -15,93 +15,167 @@ export type PromptContext =/** #general: Laya picks who answers, so prompts don't name anyone. */| { kind: 'general'; bots: PromptBot[] };+/** Chips in a 1:1 chat and #general; a team gets one more so a third member has an ask too. */export const MAX_PROMPTS = 3;+export const MAX_TEAM_PROMPTS = 4;interface Role {match: RegExp;/** Lower-case asks that read after "@Name ", the first one being the most typical. */asks: [string, string];+ /** A catch-all head word ("engineer"): any more specific role in the same title wins. */+ generic?: true;}-// Most specific first: "Sous Chef" is a sous chef before it is a chef, "DevOps" before "dev".+// Within a pattern, phrases come before single words: a regex takes the first alternative that+// matches at a position, and the longer phrase is the one that says what the job is.+// Patterns are whole words or phrases, never a bare qualifier: "product", "release", "platform",+// "designer" and "coach" say little on their own ("Product Photographer", "Press Release Writer",+// "Interior Designer", "Life Coach"), so only the phrases that pin a field down count.const ROLES: Role[] = [- { match: /\bsous\b|\bline cook\b|\bprep\b/i, asks: ['write a prep list for tonight', 'suggest a quick weeknight dinner'] },- { match: /\bpastry\b|\bbak(er|ing)\b|\bdessert/i, asks: ['suggest a dessert for this weekend', 'bake something with what I have'] },- { match: /\bnutrition|\bdiet|\bdietitian\b/i, asks: ["check this week's meals are balanced", 'make a high-protein meal plan'] },- { match: /\bchef\b|\bcook\b|\bculinary\b|\bkitchen\b|\bmenu\b|\brecipe/i, asks: ["plan this week's dinners", 'turn my fridge into a recipe'] },- { match: /\bgrocer|\bshopping\b|\bpantry\b/i, asks: ["make this week's shopping list", 'keep my groceries under budget'] },+ { match: /\bsous( chef)?\b|\bline cook\b|\bprep cook\b/i, asks: ['write a prep list for tonight', 'suggest a quick weeknight dinner'] },+ { match: /\bpastry( chef| cook)?\b|\bbak(er|ing)\b|\bdessert/i, asks: ['suggest a dessert for this weekend', 'bake something with what I have'] },+ { match: /\bnutrition(ist|al)?( coach)?\b|\bdiet(itian)?\b|\bmeal plan(ner|ning)?\b/i, asks: ["check this week's meals are balanced", 'make a high-protein meal plan'] },+ { match: /\bchef\b|\bcook\b|\bculinary\b|\bkitchen\b|\bmenu\b|\brecipes?\b/i, asks: ["plan this week's dinners", 'turn my fridge into a recipe'] },+ { match: /\bgrocer(y|ies)?( planner)?\b|\bshopping( planner)?\b|\bpantry\b/i, asks: ["make this week's shopping list", 'keep my groceries under budget'] },{ match: /\bsommelier\b|\bwine\b|\bbartender\b|\bmixolog/i, asks: ['pair a drink with dinner', 'suggest a cocktail for Friday'] },- { match: /\bfitness\b|\btrainer\b|\bcoach\b|\bworkout\b/i, asks: ['plan my workouts for the week', 'make a 20-minute home routine'] },- { match: /\bdevops\b|\bsre\b|\bsecurity\b|\binfra(structure)?\b|\bsysadmin\b|\bplatform\b/i, asks: ["check my server's security", 'set up backups for my server'] },- { match: /\bqa\b|\btest(er|ing)?\b|\bquality\b|\brelease\b/i, asks: ['write a test plan for the next release', 'find the riskiest part of this change'] },- { match: /\bdesign(er)?\b|\bux\b|\bui\b|\bfrontend\b|\bfront-end\b/i, asks: ['review the sign-up screen', 'make this page work on phones'] },+ {+ match: /\b(running|strength|gym|yoga|pilates|fitness) (coach|trainer|instructor)\b|\bpersonal trainer\b|\bfitness\b|\bworkouts?\b/i,+ asks: ['plan my workouts for the week', 'make a 20-minute home routine'],+ },+ { match: /\b(life|career|executive|mindset) coach\b|\bcoach\b|\bmentor\b/i, asks: ['help me set goals for this month', "talk through a decision I'm stuck on"] },+ {+ match: /\bdevops\b|\bsre\b|\b(cyber)?security (engineer|analyst|lead|specialist)\b|\bcybersecurity\b|\binfosec\b|\binfra(structure)?\b|\bsysadmin\b|\bplatform engineer(ing)?\b/i,+ asks: ["check my server's security", 'set up backups for my server'],+ },+ {+ match: /\bqa\b|\btest(er|ing)?\b|\bquality assurance\b|\brelease (engineer|manager)\b/i,+ asks: ['write a test plan for the next release', 'find the riskiest part of this change'],+ },+ {+ match: /\bux\b|\bui\b|\b(product|web|app|interaction|visual) designer\b|\bfrontend\b|\bfront-end\b/i,+ asks: ['review the sign-up screen', 'make this page work on phones'],+ },+ {+ match: /\b(kitchen|interior|home) designer\b|\binterior\b|\bdecorator\b|\bhome decor\b/i,+ asks: ['suggest a layout for my living room', 'pick a colour palette for a room'],+ },{ match: /\bbackend\b|\bback-end\b|\bdatabase\b|\bapi\b|\bdata engineer/i, asks: ['design the API for a new feature', 'speed up a slow database query'] },- { match: /\barchitect\b/i, asks: ['sketch the architecture for a new feature', 'weigh two ways to build this'] },- { match: /\bengineer\b|\bdeveloper\b|\bdev\b|\bprogrammer\b|\bcoder\b|\bprototyp/i, asks: ['build a quick prototype', 'review my latest changes'] },- { match: /\bseo\b|\bkeyword/i, asks: ['find keywords I could rank for', 'audit my homepage for SEO'] },- { match: /\bmarketing\b|\bmarketer\b|\bgrowth\b|\bcampaign\b|\bsocial media\b|\bbrand\b/i, asks: ['draft a launch post', 'plan a two-week campaign'] },- { match: /\bwriter\b|\bcopy(writer|writing)?\b|\bcontent\b|\beditor\b|\bauthor\b|\bblog/i, asks: ['outline a blog post', 'tighten this paragraph'] },+ { match: /\b(software|systems|solutions?) architect\b|\barchitect\b/i, asks: ['sketch the architecture for a new feature', 'weigh two ways to build this'] },+ {+ match: /\bengineer\b|\bdeveloper\b|\bdev\b|\bprogrammer\b|\bcoder\b|\bprototyp/i,+ asks: ['build a quick prototype', 'review my latest changes'],+ generic: true,+ },+ { match: /\bseo\b|\bkeywords?\b/i, asks: ['find keywords I could rank for', 'audit my homepage for SEO'] },+ { match: /\bmarketing\b|\bmarketer\b|\bgrowth\b|\bcampaigns?\b|\bsocial media\b|\bbrand\b/i, asks: ['draft a launch post', 'plan a two-week campaign'] },+ {+ match: /\bstor(y|ies|yteller|ytelling)\b|\bnovelist\b|\bpoet\b|\bfiction\b/i,+ asks: ['write a bedtime story', 'outline a short story'],+ },+ {+ match: /\bwriter\b|\bcopy(writer|writing)?\b|\bcontent\b|\beditor\b|\bauthor\b|\bblog/i,+ asks: ['outline a blog post', 'tighten this paragraph'],+ },{ match: /\bresearch|\banalyst\b|\bscout\b|\binvestigat/i, asks: ['research my top 3 competitors', 'summarise what people say about this'] },{ match: /\bsales\b|\bbusiness development\b|\blead gen/i, asks: ['draft a follow-up email to a lead', 'write a short sales pitch'] },- { match: /\bsupport\b|\bcustomer\b|\bcommunity\b/i, asks: ['draft a reply to an upset customer', 'write an FAQ answer'] },- { match: /\bfinance\b|\baccount(ant|ing)\b|\bbookkeep|\bbudget\b|\bcfo\b/i, asks: ["summarise this month's spending", 'make a simple budget'] },+ { match: /\b(customer )?support\b|\bcustomer (success|service)\b|\bcommunity\b/i, asks: ['draft a reply to an upset customer', 'write an FAQ answer'] },+ {+ match: /\bfinancial (planner|advisor)\b|\bfinanc(e|ial)\b|\baccount(ant|ing)\b|\bbookkeep|\bbudget\b|\bcfo\b/i,+ asks: ["summarise this month's spending", 'make a simple budget'],+ },{ match: /\blegal\b|\blawyer\b|\bcounsel\b|\bcompliance\b/i, asks: ['check this contract for risks', 'explain this clause simply'] },{ match: /\brecruit|\bhr\b|\bhiring\b|\bpeople ops\b/i, asks: ['write a job post', 'draft interview questions'] },{ match: /\bteacher\b|\btutor\b|\beducat|\binstructor\b/i, asks: ['explain this topic simply', 'quiz me on this'] },- { match: /\btravel\b|\btrip\b/i, asks: ['plan a weekend trip', 'make a packing list'] },- { match: /\bproduct manager\b|\bproduct owner\b|\bpm\b|\bproduct\b/i, asks: ['turn this idea into a short spec', 'prioritise these features'] },+ { match: /\b(travel|trip)( planner| agent)?\b/i, asks: ['plan a weekend trip', 'make a packing list'] },+ { match: /\bproduct (manager|owner|lead)\b|\bpm\b/i, asks: ['turn this idea into a short spec', 'prioritise these features'] },{ match: /\bassistant\b|\bsecretary\b|\bplanner\b|\bscheduler\b|\borgani[sz]er\b/i, asks: ['plan my week', 'turn these notes into a to-do list'] },- { match: /\bvideo\b|\bfilm\b|\byoutube\b|\btiktok\b/i, asks: ['script a 30-second video', 'suggest video ideas for this week'] },- { match: /\bphotograph|\billustrat|\bartist\b/i, asks: ['describe a cover image idea', 'critique this image'] },+ { match: /\bvideo( editor)?\b|\bfilm\b|\byoutube\b|\btiktok\b/i, asks: ['script a 30-second video', 'suggest video ideas for this week'] },+ { match: /\bphotograph|\billustrat|\bartist\b|\bgraphic design(er)?\b|\bcover design(er)?\b/i, asks: ['describe a cover image idea', 'critique this image'] },];+/**+ * The role a piece of text names. A title is a noun phrase whose last word is the job+ * ("Product Photographer" is a photographer), so the match ending latest wins, a longer phrase+ * breaks a tie ("Fitness Coach" over "Coach"), and a catch-all like "engineer" only counts when+ * nothing else does. In prose (a persona or a team's purpose) the first role mentioned wins.+ */+function findRole(text: string | undefined, kind: 'title' | 'prose'): Role | null {+ if (typeof text !== 'string' || !text.trim()) return null;+ let best: { role: Role; start: number; end: number } | null = null;+ for (const role of ROLES) {+ const m = role.match.exec(text);+ if (!m) continue;+ const hit = { role, start: m.index, end: m.index + m[0].length };+ if (!best) {+ best = hit;+ continue;+ }+ if (!!best.role.generic !== !!role.generic) {+ if (best.role.generic) best = hit;+ continue;+ }+ const better =+ kind === 'title'+ ? hit.end > best.end || (hit.end === best.end && hit.start < best.start)+ : hit.start < best.start || (hit.start === best.start && hit.end > best.end);+ if (better) best = hit;+ }+ return best?.role ?? null;+}+const capitalize = (s: string) => (s ? s[0].toUpperCase() + s.slice(1) : s);/** The role a bot's title says it has, else its persona's opening, else null. */export function roleOf(bot: PromptBot): Role | null {- const byText = (text: string | undefined) => (text ? ROLES.find((r) => r.match.test(text)) ?? null : null);- return byText(bot.title) ?? byText(bot.persona_prompt?.slice(0, 240));+ const persona = typeof bot.persona_prompt === 'string' ? bot.persona_prompt.slice(0, 240) : undefined;+ return findRole(bot.title, 'title') ?? findRole(persona, 'prose');}+const named = (bot: PromptBot | null | undefined): bot is PromptBot => typeof bot?.name === 'string' && !!bot.name.trim();+/** A name that works after "@": the composer's mentions are single words. */-const mentionable = (name: string) => /^[A-Za-z0-9_-]+$/.test(name);+const mentionable = (bot: PromptBot) => /^[A-Za-z0-9_-]+$/.test(bot.name);/** Asks for different roles, in the order given, one per role: [bot, ask] pairs. */function distinctAsks(bots: PromptBot[], limit: number): Array<[PromptBot, string]> {const seen = new Set<Role>();const out: Array<[PromptBot, string]> = [];for (const bot of bots) {+ if (out.length >= limit) break;const role = roleOf(bot);if (!role || seen.has(role)) continue;seen.add(role);out.push([bot, role.asks[0]]);- if (out.length >= limit) break;}return out;}export function suggestedPrompts(ctx: PromptContext): string[] {if (ctx.kind === 'bot') {- const role = roleOf(ctx.bot);+ const role = ctx.bot ? roleOf(ctx.bot) : null;if (!role) return ['What can you help me with?'];return [capitalize(role.asks[0]), capitalize(role.asks[1]), 'What can you help me with?'];}if (ctx.kind === 'general') {- if (!ctx.bots.length) return [];- const asks = distinctAsks(ctx.bots, MAX_PROMPTS - 1).map(([, ask]) => capitalize(ask));+ const bots = (ctx.bots ?? []).filter(named);+ if (!bots.length) return [];+ const asks = distinctAsks(bots, MAX_PROMPTS - 1).map(([, ask]) => capitalize(ask));return [...asks, 'Who here can help me with what?'];}- const members = ctx.members.filter((m) => m.name.trim());+ const members = (ctx.members ?? []).filter(named);if (!members.length) return [];const lead = members.find((m) => m.name === ctx.lead);const ordered = lead ? [lead, ...members.filter((m) => m !== lead)] : members;- const asks = distinctAsks(ordered.filter((m) => mentionable(m.name)), MAX_PROMPTS - 1).map(([bot, ask]) => `@${bot.name} ${ask}`);- // Nobody's title says what they do: the team's purpose may, and the lead takes it.- if (!asks.length && lead && mentionable(lead.name) && ctx.purpose) {- const role = ROLES.find((r) => r.match.test(ctx.purpose!));- if (role) asks.push(`@${lead.name} ${role.asks[0]}`);+ const asks = distinctAsks(ordered.filter(mentionable), MAX_TEAM_PROMPTS - 1).map(([bot, ask]) => `@${bot.name} ${ask}`);+ // Nobody's title says what they do: the team's purpose may, else a neutral opener. Either way+ // it goes to the lead (or the first member who can be @mentioned), never a guess at the wrong field.+ const first = ordered.find(mentionable);+ if (!asks.length && first) {+ const role = findRole(ctx.purpose, 'prose');+ asks.push(`@${first.name} ${role ? role.asks[0] : 'what should we tackle first?'}`);}return [...asks, members.length > 1 ? 'What can each of you help me with?' : 'What can you help me with?'];}diff --git a/frontend/tests/suggestedPrompts.test.mjs b/frontend/tests/suggestedPrompts.test.mjsindex b8d1d838..6d25a21d 100644--- a/frontend/tests/suggestedPrompts.test.mjs+++ b/frontend/tests/suggestedPrompts.test.mjs@@ -3,7 +3,7 @@ import test from 'node:test';import { readFileSync } from 'node:fs';import { loadBundled } from './bundle.mjs';-const { suggestedPrompts, roleOf, MAX_PROMPTS } = await loadBundled(`export * from './src/suggestedPrompts';`);+const { suggestedPrompts, roleOf, MAX_PROMPTS, MAX_TEAM_PROMPTS } = await loadBundled(`export * from './src/suggestedPrompts';`);const DEV_PROMPTS = ['Analyze system architecture tradeoffs', 'Write a fast Python script for data processing', 'Review git status and security policies'];const kitchen = [@@ -14,10 +14,15 @@ const kitchen = [{ name: 'Grocer', title: 'Grocery Planner' },];-test("a kitchen team gets the lead's and a teammate's cooking asks, never developer prompts", () => {+test("a kitchen team gets the lead's and two teammates' cooking asks, never developer prompts", () => {// What Oleks saw: a freshly hired Kitchen team offered "Analyze system architecture tradeoffs".const out = suggestedPrompts({ kind: 'team', members: kitchen, lead: 'HeadChef', purpose: 'Hired together: a team of 5.' });- assert.deepEqual(out, ["@HeadChef plan this week's dinners", "@Nutritionist check this week's meals are balanced", 'What can each of you help me with?']);+ assert.deepEqual(out, [+ "@HeadChef plan this week's dinners",+ "@Nutritionist check this week's meals are balanced",+ '@Sous write a prep list for tonight',+ 'What can each of you help me with?',+ ]);for (const p of DEV_PROMPTS) assert.ok(!out.includes(p));});@@ -40,17 +45,22 @@ test('an engineering team still gets engineering asks', () => {],lead: 'Architect',});- assert.deepEqual(out, ['@Architect sketch the architecture for a new feature', '@TechLead build a quick prototype', 'What can each of you help me with?']);+ assert.deepEqual(out, [+ '@Architect sketch the architecture for a new feature',+ '@TechLead build a quick prototype',+ "@DevOps check my server's security",+ 'What can each of you help me with?',+ ]);});-test("unknown titles fall back to the team's purpose for the lead, else just the open question", () => {+test("unknown titles fall back to the team's purpose for the lead, else a neutral opener", () => {const members = [{ name: 'Ann', title: 'Wizard' }, { name: 'Bo', title: 'Sidekick' }];assert.deepEqual(suggestedPrompts({ kind: 'team', members, lead: 'Ann', purpose: 'Plans our weekly menu' }), ["@Ann plan this week's dinners",'What can each of you help me with?',]);- assert.deepEqual(suggestedPrompts({ kind: 'team', members, lead: 'Ann' }), ['What can each of you help me with?']);- assert.deepEqual(suggestedPrompts({ kind: 'team', members: [members[0]] }), ['What can you help me with?']);+ assert.deepEqual(suggestedPrompts({ kind: 'team', members, lead: 'Bo' }), ['@Bo what should we tackle first?', 'What can each of you help me with?']);+ assert.deepEqual(suggestedPrompts({ kind: 'team', members: [members[0]] }), ['@Ann what should we tackle first?', 'What can you help me with?']);assert.deepEqual(suggestedPrompts({ kind: 'team', members: [] }), []);});@@ -76,11 +86,11 @@ test("#general draws on the space's bots without naming them, and is empty withassert.deepEqual(suggestedPrompts({ kind: 'general', bots: [] }), []);});-test('never more than three, each short enough for a phone chip', () => {+test('never more than three (four in a team), each short enough for a phone chip', () => {const many = Array.from({ length: 30 }, (_, i) => ({ name: `B${i}`, title: ['Chef', 'Writer', 'Lawyer', 'Tutor', 'SEO lead'][i % 5] }));for (const ctx of [{ kind: 'team', members: many }, { kind: 'general', bots: many }, { kind: 'bot', bot: many[0] }]) {const out = suggestedPrompts(ctx);- assert.ok(out.length <= MAX_PROMPTS, JSON.stringify(out));+ assert.ok(out.length <= (ctx.kind === 'team' ? MAX_TEAM_PROMPTS : MAX_PROMPTS), JSON.stringify(out));assert.ok(out.every((p) => p.length <= 50), JSON.stringify(out));}});@@ -99,3 +109,56 @@ test('the chat no longer hardcodes developer prompts', () => {const app = readFileSync(new URL('../src/App.tsx', import.meta.url), 'utf8');assert.match(app, /suggestedPrompts\(/);});++// Rigel's review of #61: one qualifier word used to pick the field, so these got another trade's prompts.+const askOf = (title) => roleOf({ name: 'a', title })?.asks[0] ?? null;++test('a qualifier word does not pick the field: the job at the end of the title does', () => {+ assert.equal(askOf('Product Photographer'), 'describe a cover image idea');+ assert.equal(askOf('Interior Designer'), 'suggest a layout for my living room');+ assert.equal(askOf('Press Release Writer'), 'outline a blog post');+ assert.equal(askOf('Life Coach'), 'help me set goals for this month');+ // ...while the phrases that do name those fields still work.+ assert.equal(askOf('Product Manager'), 'turn this idea into a short spec');+ assert.equal(askOf('UI/UX Designer'), 'review the sign-up screen');+ assert.equal(askOf('Release Engineer'), 'write a test plan for the next release');+ assert.equal(askOf('Fitness Coach'), 'plan my workouts for the week');+ assert.equal(askOf('Platform Engineer'), "check my server's security");+});++test("a storytelling platform's purpose gets story prompts, not server security", () => {+ const out = suggestedPrompts({ kind: 'team', members: [{ name: 'Ann', title: 'Wizard' }, { name: 'Bo', title: 'Sidekick' }], lead: 'Ann', purpose: 'Platform for Kids Storytelling' });+ assert.deepEqual(out, ['@Ann write a bedtime story', 'What can each of you help me with?']);+ assert.equal(askOf('Platform for Kids Storytelling'), 'write a bedtime story');+});++test('the five titles from the review, as one team, each get their own field', () => {+ const out = suggestedPrompts({+ kind: 'team',+ members: [+ { name: 'Snap', title: 'Product Photographer' },+ { name: 'Deco', title: 'Interior Designer' },+ { name: 'Press', title: 'Press Release Writer' },+ { name: 'Guide', title: 'Life Coach' },+ ],+ lead: 'Snap',+ });+ assert.deepEqual(out, [+ '@Snap describe a cover image idea',+ '@Deco suggest a layout for my living room',+ '@Press outline a blog post',+ 'What can each of you help me with?',+ ]);+ for (const p of out) assert.doesNotMatch(p, /spec|sign-up|test plan|workout|server/);+});++test('a member or bot with a missing name or title is skipped, not a crash', () => {+ const members = [{ name: undefined, title: 'Chef' }, { name: ' ', title: 'Chef' }, null, { name: 'Sous', title: undefined, persona_prompt: 42 }, { name: 'Nut', title: 'Nutritionist' }];+ assert.deepEqual(suggestedPrompts({ kind: 'team', members, lead: 'Nut' }), ["@Nut check this week's meals are balanced", 'What can each of you help me with?']);+ assert.deepEqual(suggestedPrompts({ kind: 'general', bots: [{ title: 'Chef' }, { name: 'Nut', title: 'Nutritionist' }] }), [+ "Check this week's meals are balanced",+ 'Who here can help me with what?',+ ]);+ assert.deepEqual(suggestedPrompts({ kind: 'team', members: [{ title: 'Chef' }] }), []);+ assert.deepEqual(suggestedPrompts({ kind: 'bot', bot: {} }), ['What can you help me with?']);+});