Skip to content

armgit / kwant

Public Imported from GitHub
0

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.

Home Assistant polish: URL wraps at "/", lock asks in words, House chips, true device line (#784)

Oleksandr Ivanchenko177f243e0d12
diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx
index 0ea1e6af..6409a9a2 100644
--- a/frontend/src/App.tsx
+++ b/frontend/src/App.tsx
@@ -77,7 +77,7 @@ import { IdeaDropToast, type IdeaDropToastState } from './components/IdeaDropToa
import { JAR_DROPPED, JAR_SEND_FAILED, ideaSendOutcome, useJarWobble, wobbleJar } from './ideaShell';
import { Bot, HelpCircle, Inbox, ListChecks, Loader2, MessageSquare, Settings } from 'lucide-react';
import { TG_EVENT, TelegramEventDetail, forThisSpace } from './telegram';
-import { ChatApproval, OpenChat, addSettled, refusedFromRecords, settledByTime, settledFromRecords, withdrawApproval, approvalFromEvent, lateAnswerText, approvalsForChat, approvalsFromAway, syncApprovals, upsertApproval, withoutApproval } from './approvals';
+import { ChatApproval, OpenChat, addSettled, refusedFromRecords, settledByTime, settledFromRecords, withdrawApproval, approvalFromEvent, lateAnswerText, approvalsForChat, approvalsFromAway, awayTitle, syncApprovals, upsertApproval, withoutApproval } from './approvals';
import type { AgentFormData } from './components/NewAgentModal';
import { NewTeamModal } from './components/NewTeamModal';
import { ReadyTeamsProvider, TeamNeedsTop, type ReadyTeam } from './components/ReadyTeams';
@@ -682,7 +682,7 @@ export const SpaceApp: React.FC<SpaceAppProps> = ({
nudgesOnRef.current = nudgesOn;
const pageRef = useRef(page);
pageRef.current = page;
- const arrivalsRef = useRef(createArrivals());
+ const arrivalsRef = useRef(createArrivals(awayTitle));
const offerNudges = (arrivals: Nudge[]) => {
const view = { openCtx: pageRef.current === 'chat' ? openCtxRef.current : null, onInbox: pageRef.current === 'inbox', hidden: document.hidden, enabled: nudgesOnRef.current };
const shown = arrivals.filter((n) => shouldPill(n, view));
diff --git a/frontend/src/approvals.ts b/frontend/src/approvals.ts
index 9df23e12..2331f29d 100644
--- a/frontend/src/approvals.ts
+++ b/frontend/src/approvals.ts
@@ -2,7 +2,7 @@
// reconnect, by `GET /api/away`'s waiting items, so a card never depends on the page having been
// open when the bot asked. Pure helpers, shared by the app and the node tests.
-import { approvalAction, type PendingApproval } from './components/ModernApprovalCard';
+import { approvalAction, homeView, type PendingApproval } from './components/ModernApprovalCard';
import type { AwayItem, AwayLink } from './away';
/** A card plus where it belongs: the asking bot and, when the server knows it, the conversation. */
@@ -50,6 +50,23 @@ export function awayTitle(item: AwayItem): string {
return action.charAt(0).toUpperCase() + action.slice(1);
}
+/**
+ * The one-line ask for an approval in the Needs-you strip and the sidebar pin tip: the card's own
+ * sentence ("House wants to unlock Front door"). A Home Assistant call always reads this way; any
+ * other approval only when the server sent its raw "Use <tool> (<server>)" title and no question.
+ * Null means the caller keeps its usual line (askLine).
+ */
+export function approvalLine(item: AwayItem): string | null {
+ if (item.kind !== 'approval') return null;
+ const approval = approvalFromAway(item);
+ const home = homeView(approval) !== null;
+ const raw = !(item.question ?? '').trim() && /^Use\s+\S/.test((item.title ?? '').trim());
+ if (!home && !raw) return null;
+ const action = approvalAction(approval);
+ const bot = (item.kwant_name ?? '').trim();
+ return bot ? `${bot} wants to ${action}` : action.charAt(0).toUpperCase() + action.slice(1);
+}
+
/**
* What to tell the person after they answered a card. A late Allow on a still-open card starts
* the bot again (`resumed: "new_turn"`); otherwise null (nothing worth saying).
diff --git a/frontend/src/attention.ts b/frontend/src/attention.ts
index 099d71b8..fa30ab19 100644
--- a/frontend/src/attention.ts
+++ b/frontend/src/attention.ts
@@ -51,14 +51,20 @@ export function awayCtx(item: Pick<AwayItem, 'kwant_id' | 'link'>): string {
return 'thread' in t ? t.thread : 'channel' in t ? t.channel : t.direct;
}
-export function nudgeFromAway(item: AwayItem): Nudge | null {
+/** How an away item's title reads in the pill. The app passes awayTitle (approvals.ts) so an approval says
+ * what it does ("Unlock Front door") instead of the server's "Use <tool> (<server>)"; it's passed in
+ * so this file stays free of the approval card and its imports. */
+export type TitleOf = (item: AwayItem) => string;
+const rawTitle: TitleOf = (item) => item.title;
+
+export function nudgeFromAway(item: AwayItem, titleOf: TitleOf = rawTitle): Nudge | null {
if (item.kind !== 'question' && item.kind !== 'approval') return null;
return {
key: `${item.kind}:${item.id}`,
kind: item.kind,
kwantId: item.kwant_id,
kwantName: item.kwant_name,
- title: item.title,
+ title: titleOf(item),
ctx: awayCtx(item),
away: item,
};
@@ -87,14 +93,14 @@ export function shouldPill(n: Pick<Nudge, 'ctx'>, view: AttentionView): boolean
* app opens is shown by the badge, title and Inbox, not by a pill); after that only ids it has
* never seen are arrivals.
*/
-export function createArrivals() {
+export function createArrivals(titleOf: TitleOf = rawTitle) {
let primed = false;
const seen = new Set<string>();
const steps = new Map<string, number>();
return {
/** The waiting list from /api/away: the new items, in the server's order (newest first). */
fromAway(items: readonly AwayItem[]): Nudge[] {
- const nudges = items.map(nudgeFromAway).filter((n): n is Nudge => !!n);
+ const nudges = items.map((i) => nudgeFromAway(i, titleOf)).filter((n): n is Nudge => !!n);
const fresh = primed ? nudges.filter((n) => !seen.has(n.key)) : [];
for (const n of nudges) seen.add(n.key);
primed = true;
diff --git a/frontend/src/components/HomeAssistantSheet.tsx b/frontend/src/components/HomeAssistantSheet.tsx
index 4089e107..17f6d23a 100644
--- a/frontend/src/components/HomeAssistantSheet.tsx
+++ b/frontend/src/components/HomeAssistantSheet.tsx
@@ -30,6 +30,25 @@ export function openHomeAssistant(req: HomeAssistantRequest): void {
window.dispatchEvent(new window.CustomEvent<HomeAssistantRequest>(HA_EVENT, { detail: req }));
}
+/**
+ * A URL that wraps only after a "/" on a narrow screen ("…:8123/ | api/ | mcp"), never mid-word.
+ * The scheme's "//" is one break point, so it never splits between the two slashes.
+ */
+export function urlWithBreaks(url: string): React.ReactNode[] {
+ const out: React.ReactNode[] = [];
+ let rest = url;
+ const scheme = /^[a-z][a-z0-9+.-]*:\/\//i.exec(rest);
+ if (scheme) {
+ out.push(scheme[0], <wbr key="s" />);
+ rest = rest.slice(scheme[0].length);
+ }
+ rest.split(/(?<=\/)/).forEach((part, i, all) => {
+ out.push(part);
+ if (i < all.length - 1 && part.endsWith('/')) out.push(<wbr key={i} />);
+ });
+ return out;
+}
+
const readError = async (res: Response) => {
try {
const body = await res.json();
@@ -329,7 +348,7 @@ export const HomeAssistantSheet: React.FC<HomeAssistantSheetProps> = ({ req, onC
'That doesn’t look like an address. Try homeassistant.local:8123.'
) : parsed ? (
<>
- kwant will connect to <span className="font-mono text-zinc-300 break-all">{parsed.url}</span>
+ kwant will connect to <span className="font-mono text-zinc-300 break-words" data-ha-url>{urlWithBreaks(parsed.url)}</span>
</>
) : (
<>
diff --git a/frontend/src/components/NeedsYouStrip.tsx b/frontend/src/components/NeedsYouStrip.tsx
index 1cdc119d..d2613bab 100644
--- a/frontend/src/components/NeedsYouStrip.tsx
+++ b/frontend/src/components/NeedsYouStrip.tsx
@@ -1,6 +1,7 @@
import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
import { ArrowUp, Check, ChevronLeft, ChevronRight, Globe, Hand, Inbox, Loader2, Play, RotateCcw, type LucideIcon } from 'lucide-react';
import type { AwayItem } from '../away';
+import { approvalLine } from '../approvals';
import { localClock } from '../clock';
import {
ACTION_LABEL,
@@ -367,7 +368,7 @@ export const NeedsYouStrip: React.FC<NeedsYouStripProps> = ({ asks, onAction, on
</p>
{/* The whole line, never cut: it wraps, and the box scrolls past 240 px. */}
<p data-strip-line className="mt-0.5 text-body font-medium text-zinc-50 break-words">
- {askLine(item)}
+ {approvalLine(item) ?? askLine(item)}
</p>
<p data-strip-hint className={`mt-0.5 text-meta ${gone ? 'text-zinc-300' : 'text-zinc-400'}`}>
{hint}
diff --git a/frontend/src/components/Sidebar.tsx b/frontend/src/components/Sidebar.tsx
index 785373d8..0c120e1d 100644
--- a/frontend/src/components/Sidebar.tsx
+++ b/frontend/src/components/Sidebar.tsx
@@ -19,6 +19,7 @@ import { PhoneAppTip } from './PhoneAppTip';
import { trapFocusTarget } from '../imports';
import { type AttentionRow, type NeedsYouRow, PINNED_RANK, NEEDS_YOU_LABEL, workingIds, directIds, rollupLabel } from '../chatsTab';
import { askAction, askKind, askLine, isAsk } from '../askHere';
+import { approvalLine } from '../approvals';
import { localClock } from '../clock';
import type { InboxItem } from '../api/inbox';
import { useDevMode } from './DevModeSwitch';
@@ -537,7 +538,7 @@ export const Sidebar: React.FC<SidebarProps> = ({
// 22i: a pinned row's line is cut to one line; hover and focus show the whole ask in a small tooltip
// (design.md §4): "Quant · Stopped · 18:44" over the full line. A native title never shows on focus.
const rowItem = asked?.item ?? att?.item;
- const fullLine = pin && busyLine ? (rowItem && isAsk(rowItem) ? askLine(rowItem) || busyLine : busyLine) : undefined;
+ const fullLine = pin && busyLine ? (rowItem && isAsk(rowItem) ? (approvalLine(rowItem) ?? askLine(rowItem)) || busyLine : busyLine) : undefined;
const tipKind = !att
? undefined
: att.rank === 3
diff --git a/frontend/src/suggestedPrompts.ts b/frontend/src/suggestedPrompts.ts
index c787ca95..4d0f90b7 100644
--- a/frontend/src/suggestedPrompts.ts
+++ b/frontend/src/suggestedPrompts.ts
@@ -97,6 +97,8 @@ const ROLES: Role[] = [
{ match: /\bteacher\b|\btutor\b|\beducat|\binstructor\b/i, asks: ['explain this topic simply', 'quiz me on this'] },
{ 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'] },
+ // House ("Home Helper", "…through Home Assistant") is tested before the assistant role below.
+ { match: /\bhome assistant\b|\bsmart home\b|\bhome (helper|automation)\b/i, asks: ['is anything left on?', 'turn off all the lights'] },
{ 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( 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'] },
diff --git a/frontend/src/whatsnew/0.9.21.json b/frontend/src/whatsnew/0.9.21.json
index ba5312f7..cb7a1363 100644
--- a/frontend/src/whatsnew/0.9.21.json
+++ b/frontend/src/whatsnew/0.9.21.json
@@ -5,7 +5,7 @@
{
"id": "home-assistant",
"title": "Connect Home Assistant in two fields",
- "text": "Paste your Home Assistant's address and an access token, and your bots can see and switch the devices you share with Assist. If it doesn't connect, the sheet says why in plain words.",
+ "text": "Paste your Home Assistant's address and an access token, and your bots can see and switch your devices. If it doesn't connect, the sheet says why in plain words.",
"image": "home-assistant.webp",
"open": null
},
diff --git a/frontend/tests/approvals.test.mjs b/frontend/tests/approvals.test.mjs
index b52c70ce..f03b00ea 100644
--- a/frontend/tests/approvals.test.mjs
+++ b/frontend/tests/approvals.test.mjs
@@ -1,11 +1,13 @@
import assert from 'node:assert/strict';
import test from 'node:test';
+import { readFileSync } from 'node:fs';
import { loadBundled } from './bundle.mjs';
// Sound settings and the chat read localStorage on import.
globalThis.localStorage ??= { getItem: () => null, setItem: () => {}, removeItem: () => {} };
const a = await loadBundled(`export * from './src/approvals';`);
+const att = await loadBundled(`export * from './src/attention';`);
const ui = await loadBundled(`
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server.browser';
@@ -121,3 +123,51 @@ test('a reloaded payment keeps its reason in every form the server sends, so no
assert.equal(plain.details.source, 'summary');
assert.equal('payment_reason' in plain.details, false);
});
+
+// ha-sheet-polish (b): the Needs-you strip and the sidebar pin tip say the card's sentence, never the
+// server's raw "Use intent__HassTurnOff (home-assistant)" (Mira's 0.9.21 follow-up 2).
+// Shaped like the 0.9.21 shot rig's lock ask (homeAssistant.test.mjs's haTicket, as an Inbox item).
+const haItem = (args, over = {}) => ({
+ kind: 'approval', id: 'h1', kwant_id: 'k-house', kwant_name: 'House', status: 'waiting',
+ title: 'Use intent__HassTurnOff (home-assistant)', summary: '',
+ tool_name: 'mcp__home-assistant__intent__HassTurnOff',
+ details: { source: 'mcp', server: 'home-assistant', tool: 'intent__HassTurnOff', arguments: args },
+ ...over,
+});
+
+test('approvalLine: a Home Assistant lock ask reads like its card, even when the server set a question', () => {
+ const lock = { name: 'Front door', area: 'Hallway', domain: ['lock'] };
+ assert.equal(a.approvalLine(haItem(lock)), 'House wants to unlock Front door');
+ assert.equal(a.approvalLine(haItem(lock, { question: 'Turn off “Front door”?' })), 'House wants to unlock Front door');
+ assert.equal(a.approvalLine(haItem({ name: 'Living room lamp' })), 'House wants to turn off Living room lamp');
+ // The always-ask floor with no domain never reads "turn off"
+ const floor = haItem({ name: 'Front door' });
+ floor.details.home_always_ask = true;
+ assert.equal(a.approvalLine(floor), 'House wants to unlock or open Front door');
+ // No bot name: the action alone, capitalised, as awayTitle does
+ assert.equal(a.approvalLine(haItem(lock, { kwant_name: '' })), 'Unlock Front door');
+});
+
+test('approvalLine: a raw "Use <tool> (<server>)" title with no question gives the card sentence; anything else keeps its line', () => {
+ const gh = { kind: 'approval', id: 'g1', kwant_id: 'k-ann', kwant_name: 'Ann', title: 'Use create_pull_request (github)', summary: '', status: 'waiting' };
+ assert.equal(a.approvalLine(gh), 'Ann wants to open a pull request');
+ assert.equal(a.approvalLine(bashItem()), 'Dev wants to run a command');
+ // A question the server wrote wins for a non-home tool; so does a title already in words
+ assert.equal(a.approvalLine({ ...gh, question: 'Open “Fix checkout” on demo-app?' }), null);
+ assert.equal(a.approvalLine({ ...gh, title: 'Wants to run a command' }), null);
+ // Not an approval: never touched
+ assert.equal(a.approvalLine({ kind: 'stopped', id: 's1', kwant_id: 'k', kwant_name: 'Q', title: 'Use the retry', summary: '', status: 'open' }), null);
+});
+
+test('the needs-you pop-up names a Home Assistant lock ask in words, like its Inbox row', () => {
+ const lock = haItem({ name: 'Front door', area: 'Hallway', domain: ['lock'] });
+ lock.link = { thread_id: null, channel_id: null, direct_kwant_id: lock.kwant_id };
+ const text = att.pillText([att.nudgeFromAway(lock, a.awayTitle)]);
+ assert.equal(text.headline, 'House needs your OK');
+ assert.equal(text.detail, 'Unlock Front door');
+ // A question keeps its own words
+ const q = { ...lock, kind: 'question', id: 'q1', title: 'Ship it today?' };
+ assert.equal(att.nudgeFromAway(q, a.awayTitle).title, 'Ship it today?');
+ // The app hands awayTitle to the arrivals tracker that feeds the pill
+ assert.match(readFileSync(new URL('../src/App.tsx', import.meta.url), 'utf8'), /createArrivals\(awayTitle\)/);
+});
diff --git a/frontend/tests/askHere.test.mjs b/frontend/tests/askHere.test.mjs
index 4065f329..eaf7a6ed 100644
--- a/frontend/tests/askHere.test.mjs
+++ b/frontend/tests/askHere.test.mjs
@@ -20,6 +20,7 @@ const m = await loadBundled(`
export { flushSync } from 'react-dom';
export { renderToStaticMarkup } from 'react-dom/server.browser';
export * from './src/askHere';
+ export { approvalLine } from './src/approvals';
export { NeedsYouStrip } from './src/components/NeedsYouStrip';
export { Sidebar } from './src/components/Sidebar';
export { needsYouRows, attentionRows } from './src/chatsTab';
@@ -570,3 +571,35 @@ test('fixes 2, 7, 8: phone browser step stacks, icons never shrink, compact step
for (const l of ['Previous ask', 'Next ask']) assert.ok(r.host.querySelector(`[aria-label="${l}"]`).hasAttribute('data-compact'));
r.unmount();
});
+
+// ha-sheet-polish (b): a Home Assistant lock ask in the strip and the pin tip says the card's sentence.
+const lockAsk = item('approval', {
+ id: 'h1', kwant_id: 'house', kwant_name: 'House', title: 'Use intent__HassTurnOff (home-assistant)',
+ tool_name: 'mcp__home-assistant__intent__HassTurnOff', link: link({ direct_kwant_id: 'house' }),
+ details: { source: 'mcp', server: 'home-assistant', tool: 'intent__HassTurnOff', arguments: { name: 'Front door', area: 'Hallway', domain: ['lock'] } },
+});
+
+test('strip: a Home Assistant lock ask reads "House wants to unlock Front door", not the raw tool call', () => {
+ const d = parse(h(m.NeedsYouStrip, { asks: [lockAsk], onAction: noop, onDismiss: async () => {}, onShow: noop, now: NOW }));
+ const line = d.querySelector('[data-strip-line]').textContent;
+ assert.equal(line, 'House wants to unlock Front door');
+ assert.ok(!/intent__|home-assistant|^Use /.test(line));
+ // Other approvals keep their line (askLine): the question, or a title already in words
+ const q = item('approval', { title: 'Wants to run a command', question: 'Run “deploy.sh prod”?' });
+ assert.equal(m.approvalLine(q) ?? m.askLine(q), 'Run “deploy.sh prod”?');
+ const w = item('approval', { title: 'Wants to run a command' });
+ assert.equal(m.approvalLine(w) ?? m.askLine(w), 'Wants to run a command');
+});
+
+test('pinned row tooltip: a Home Assistant lock ask says the card sentence too', () => {
+ const kwants = [bot('house', 'House')];
+ const needs = m.needsYouRows([lockAsk], {}, new Set(['house']));
+ const html = m.renderToStaticMarkup(h(m.Sidebar, {
+ space, spaces: [space], onSwitchSpace: noop, onCreateSpace: noop, onOpenSpaceSettings: noop, onOpenArchived: noop, onOpenSearch: noop,
+ kwants, channels: [], teams: [], selectedId: null, isChannel: false, onSelectKwant: noop, onSelectChannel: noop, onSelectTeam: noop,
+ onSummonKwant: noop, onCreateTeam: noop, onOpenInbox: noop, onOpenNeedsYou: noop, busyKwants: {}, botStatus: {},
+ attention: m.attentionRows({ kwants, needs, now: Date.parse('2026-11-15T17:45:00Z') }),
+ }));
+ const d = new DOMParser().parseFromString(`<body>${html}</body>`, 'text/html');
+ assert.equal(d.querySelector('#pin-tip-house span:last-child').textContent, 'House wants to unlock Front door');
+});
diff --git a/frontend/tests/attention.test.mjs b/frontend/tests/attention.test.mjs
index 02df15a3..bdcfb939 100644
--- a/frontend/tests/attention.test.mjs
+++ b/frontend/tests/attention.test.mjs
@@ -109,6 +109,16 @@ test('the words: who and what for one, a count for several', () => {
assert.equal(a.pillText([]).headline, '');
});
+test('the pill title comes from the titleOf the app passes; without one it keeps the server title', () => {
+ const titleOf = (i) => (i.kind === 'approval' ? `Words for ${i.id}` : i.title);
+ assert.equal(a.nudgeFromAway(item('a1', 'approval'), titleOf).title, 'Words for a1');
+ assert.equal(a.nudgeFromAway(item('q1'), titleOf).title, 'Title q1');
+ assert.equal(a.nudgeFromAway(item('a1', 'approval')).title, 'Title a1');
+ const arr = a.createArrivals(titleOf);
+ arr.fromAway([]);
+ assert.deepEqual(arr.fromAway([item('a2', 'approval')]).map((n) => n.title), ['Words for a2']);
+});
+
const env = ({ stored = null, reduced = false, nav } = {}) => {
const store = new Map(stored === null ? [] : [[a.NUDGES_KEY, stored]]);
const events = [];
diff --git a/frontend/tests/homeAssistant.test.mjs b/frontend/tests/homeAssistant.test.mjs
index 1e599c7c..271e642e 100644
--- a/frontend/tests/homeAssistant.test.mjs
+++ b/frontend/tests/homeAssistant.test.mjs
@@ -21,7 +21,7 @@ const m = await loadBundled(`
export * from './src/homeAssistant';
export { homeAction, homePhrase, readableStepTitle } from './src/toolLabel';
export { ModernApprovalCard, approvalAction } from './src/components/ModernApprovalCard';
- export { HomeAssistantSheet } from './src/components/HomeAssistantSheet';
+ export { HomeAssistantSheet, urlWithBreaks } from './src/components/HomeAssistantSheet';
export { needView } from './src/teams/teamTemplates';
export { TEMPLATES_WIRE } from './src/teams/templateFixtures';
export { newKey, isNewThing } from './src/whatsNew';
@@ -419,3 +419,11 @@ test('D2: the welcome grid’s Home card has the home-team New tag; picking it c
g.fetch = g.window.fetch = realFetch;
}
});
+
+// ha-sheet-polish (a): the "kwant will connect to" URL wraps only after a "/", never mid-word ("/api/m|cp").
+test('the connect URL breaks only after each "/", with the scheme\'s "//" kept whole', () => {
+ const html = m.renderToStaticMarkup(h('span', null, ...m.urlWithBreaks('http://homeassistant.local:8123/api/mcp')));
+ assert.equal(html, '<span>http://<wbr/>homeassistant.local:8123/<wbr/>api/<wbr/>mcp</span>');
+ assert.ok(!html.includes('/<wbr/>/'), 'never between the two slashes');
+ assert.equal(m.renderToStaticMarkup(h('span', null, ...m.urlWithBreaks('https://ha.example.com/api/mcp/'))), '<span>https://<wbr/>ha.example.com/<wbr/>api/<wbr/>mcp/</span>');
+});
diff --git a/frontend/tests/suggestedPrompts.test.mjs b/frontend/tests/suggestedPrompts.test.mjs
index 6d24bbcc..cc7030a2 100644
--- a/frontend/tests/suggestedPrompts.test.mjs
+++ b/frontend/tests/suggestedPrompts.test.mjs
@@ -241,3 +241,27 @@ test('a storytelling team with a sound engineer gets no developer prompt, and an
});
assert.deepEqual(civil, ['@Bridge what should we tackle first?', 'What can each of you help me with?']);
});
+
+// ha-sheet-polish (c): House, the Home template's lead, gets home chips, not "Plan my week".
+const house = {
+ name: 'House', title: 'Home Helper',
+ persona_prompt: 'You are House, the lead of the @home team. You look after one home through Home Assistant. You answer questions about the home.',
+};
+
+test('House in a 1:1 gets home asks, and the persona order does not matter', () => {
+ assert.deepEqual(suggestedPrompts({ kind: 'bot', bot: house }), ['Is anything left on?', 'Turn off all the lights', 'What can you help me with?']);
+ // The title alone is enough; a persona that only says "Home Assistant" is too
+ assert.deepEqual(suggestedPrompts({ kind: 'bot', bot: { name: 'H', title: 'Home Helper' } })[0], 'Is anything left on?');
+ assert.deepEqual(suggestedPrompts({ kind: 'bot', bot: { name: 'H', title: '', persona_prompt: 'You run the smart home through Home Assistant.' } })[0], 'Is anything left on?');
+ assert.deepEqual(suggestedPrompts({ kind: 'bot', bot: { name: 'H', title: 'Home Assistant' } })[0], 'Is anything left on?');
+});
+
+test('an Assistant or a Planner bot still gets "Plan my week"', () => {
+ for (const title of ['Assistant', 'Personal Assistant', 'Planner', 'Executive Assistant']) {
+ assert.equal(suggestedPrompts({ kind: 'bot', bot: { name: 'A', title } })[0], 'Plan my week', title);
+ }
+});
+
+test("@home (a team chat) shows House's asks", () => {
+ assert.deepEqual(suggestedPrompts({ kind: 'team', members: [house], lead: 'House' }), ['@House is anything left on?', 'What can you help me with?']);
+});
diff --git a/site-src/features.html b/site-src/features.html
index 8c6d6f31..f00a8e40 100644
--- a/site-src/features.html
+++ b/site-src/features.html
@@ -61,7 +61,7 @@ card_art: team
<div class="row">
<div class="row-copy">
<h3 id="connect-home-assistant">Connect Home Assistant</h3>
- <p><strong>Connect Home Assistant</strong> takes two things: your Home Assistant's address and an access token. The sheet builds the connection, tests it, and names the problem in plain words when it fails (a wrong token, MCP Server off, an address it can't reach). Bots see only the devices you share with Assist. Start from <strong>Tools › Find a tool</strong>, or pick the new <strong>Home</strong> team: House checks your home and switches things with your OK, and its Lights out routine starts off.</p>
+ <p><strong>Connect Home Assistant</strong> takes two things: your Home Assistant's address and an access token. The sheet builds the connection, tests it, and names the problem in plain words when it fails (a wrong token, MCP Server off, an address it can't reach). Bots can reach every device unless you limit them in Home Assistant. Start from <strong>Tools › Find a tool</strong>, or pick the new <strong>Home</strong> team: House checks your home and switches things with your OK, and its Lights out routine starts off.</p>
</div>
<div class="frame">{{shot:v0921-home-assistant|The Connect Home Assistant sheet over the @home team chat in kwant. Address homeassistant.local, "kwant will connect to http://homeassistant.local:8123/api/mcp", a saved access token, notes that bots can reach every device unless limited in Home Assistant and that locks, doors, garage doors, gates and alarms always ask, then "Connected · 14 actions" with a Tested sticker and "House can use it now."}}</div>
</div>
diff --git a/site/features.html b/site/features.html
index 667820b8..58641aab 100644
--- a/site/features.html
+++ b/site/features.html
@@ -102,7 +102,7 @@
<div class="row">
<div class="row-copy">
<h3 id="connect-home-assistant">Connect Home Assistant</h3>
- <p><strong>Connect Home Assistant</strong> takes two things: your Home Assistant's address and an access token. The sheet builds the connection, tests it, and names the problem in plain words when it fails (a wrong token, MCP Server off, an address it can't reach). Bots see only the devices you share with Assist. Start from <strong>Tools › Find a tool</strong>, or pick the new <strong>Home</strong> team: House checks your home and switches things with your OK, and its Lights out routine starts off.</p>
+ <p><strong>Connect Home Assistant</strong> takes two things: your Home Assistant's address and an access token. The sheet builds the connection, tests it, and names the problem in plain words when it fails (a wrong token, MCP Server off, an address it can't reach). Bots can reach every device unless you limit them in Home Assistant. Start from <strong>Tools › Find a tool</strong>, or pick the new <strong>Home</strong> team: House checks your home and switches things with your OK, and its Lights out routine starts off.</p>
</div>
<div class="frame"><a class="zoom" href="assets/media/v0921-home-assistant-2880.webp?v=31df90eccc" data-caption="The Connect Home Assistant sheet over the @home team chat in kwant. Address homeassistant.local, &quot;kwant will connect to http://homeassistant.local:8123/api/mcp&quot;, a saved access token, notes that bots can reach every device unless limited in Home Assistant and that locks, doors, garage doors, gates and alarms always ask, then &quot;Connected · 14 actions&quot; with a Tested sticker and &quot;House can use it now.&quot;"><img class="app" src="assets/media/v0921-home-assistant-1440.webp?v=98cfd61cf9" srcset="assets/media/v0921-home-assistant-1440.webp?v=98cfd61cf9 1440w, assets/media/v0921-home-assistant-2880.webp?v=31df90eccc 2880w" sizes="(max-width: 1024px) 100vw, 680px" width="1440" height="900" loading="lazy" decoding="async" alt="The Connect Home Assistant sheet over the @home team chat in kwant. Address homeassistant.local, &quot;kwant will connect to http://homeassistant.local:8123/api/mcp&quot;, a saved access token, notes that bots can reach every device unless limited in Home Assistant and that locks, doors, garage doors, gates and alarms always ask, then &quot;Connected · 14 actions&quot; with a Tested sticker and &quot;House can use it now.&quot;"></a></div>
</div>