Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions src/kiro_crew/docs/ui-index.generated.json

Large diffs are not rendered by default.

15 changes: 15 additions & 0 deletions website/docs/narrow-viewport.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,21 @@ the apps, behind a separator. The decision reads `stableRailHeight` — the tall
height seen at the current window width — so the on-screen keyboard or a browser
toolbar shrinking the rail at the same width never moves the tiles.

**The Crewmates page hosts the same drawer.** On a phone `/members` lands on a
crewmate exactly as a wide window does, and its roster is a left drawer over the
open chat: the same rail (App provides `MobileNavRailContext` on this route too)
beside the roster aside, which is portaled into the drawer while a chat or team
is open. A rightward drag or the header's back control reveals it, a leftward
drag reveals the side panel (a full-width overlay that slides on `sidePanelX`),
and each gesture is off while the other's panel is open. The drawer mints the
same duplicate history entry, and a roster pick spends it FIRST, then opens the
crewmate on the entry below (`consumeRosterDrawerEntry`), so Back never reopens
the crewmate just left. With nothing open the roster is the page, the page
binds nothing and claims no side, and the shell's nav-drawer swipe works there.
The rail's Home control navigates with `replace` without closing the drawer
when its host is not the chat page, since that close would pop the entry after
the replace.

**Haptics.** `lib/haptic.ts` makes one best-effort tap: `navigator.vibrate` on
Android, the hidden switch-checkbox click on iOS where the `switch` attribute exists
(iOS 17.4+), and a silent no-op everywhere else; it never throws. Call it for a
Expand Down
20 changes: 17 additions & 3 deletions website/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1511,9 +1511,12 @@ export default function App() {
* pinned at the bottom and opens the same command palette the header's
* search square used to.
*
* `null` off the phone chat page, so every other consumer renders no rail.
* `null` off the phone chat and Crewmates pages, so every other consumer
* renders no rail. The Crewmates page hosts it the same way, beside its
* roster in the drawer over the open chat.
*/
const mobileNavRail = mobileSingle
const railHost = mobileSingle || (isMobile && (activePath === '/members' || activePath.startsWith('/members/')))
const mobileNavRail = railHost
? ({ onActivate }: MobileNavRailOptions) => {
const railRow = (
n: { path: string; id: string; label: string; labelKey?: string; icon: React.ReactNode; appName?: string },
Expand Down Expand Up @@ -1552,7 +1555,18 @@ export default function App() {
<button
type="button"
data-testid="mobile-nav-rail-home"
onClick={() => { onActivate(); if (!(activePath === '/chat' || activePath === '/')) navigate('/chat', { replace: true }) }}
// On the chat page it closes the host drawer (and goes to the chat
// root). From another host page it navigates with `replace` and
// does NOT close first: closing pops the drawer's duplicate
// entry, and that pop would land after the replace and carry the
// user back to the page being left. Leaving asks the page's
// leave guard first, as every rail row does, so a draft held
// there (a Profile schedule form) is not dropped silently.
onClick={() => {
if (!isChat) { if (mayLeaveForErrorHandoff()) navigate('/chat', { replace: true }); return }
onActivate()
if (!(activePath === '/chat' || activePath === '/')) navigate('/chat', { replace: true })
}}
className="w-11 h-11 mb-1 flex items-center justify-center shrink-0 rounded-xl bg-transparent border-none cursor-pointer"
// Named for what it DOES (home = the chat root), not for the brand
// it shows: an icon-only control announced as the product name told
Expand Down
6 changes: 4 additions & 2 deletions website/src/components/MobileNavRailContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import { createContext, useContext, type ReactNode } from 'react'
* shell's — its rows come from the same nav registry, badges and active-state
* rules the desktop rail and the mobile nav drawer render, so it is rendered by
* `App.tsx` and handed down here rather than rebuilt from a second list inside
* the chat page. `App.tsx` provides a renderer only while the chat route is
* mounted on a phone; every other surface reads `null` and renders no rail.
* the chat page. `App.tsx` provides a renderer only while the chat route or the
* Crewmates route is mounted on a phone (the Crewmates page hosts the rail the
* same way, beside its roster drawer); every other surface reads `null` and
* renders no rail.
*
* A render FUNCTION, not a node: the drawer owns the close gesture, so it has
* to say what a row tap that STAYS on the chat page does to it (`onActivate`
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -17991,7 +17991,7 @@
"dashboard_render_error": "এই ড্যাশবোর্ড আঁকা যায়নি।",
"dashboard_frame_title": "{{crew}}-এর ড্যাশবোর্ড",
"dashboard_rendering": "ড্যাশবোর্ড আঁকা হচ্ছে…",
"back_to_roster": "সঙ্গীদের তালিকায় ফিরুন",
"toggle_roster": "সঙ্গীদের তালিকা দেখাও/লুকাও",
"fresh_start": "নতুন করে শুরু",
"fresh_start_failed": "নতুন করে শুরু শেষ হয়নি। কথোপকথন রাখা আছে।",
"fresh_start_confirm_title": "এই সঙ্গীকে নতুন করে শুরু করাবে?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -17991,7 +17991,7 @@
"dashboard_render_error": "Dieses Dashboard konnte nicht gezeichnet werden.",
"dashboard_frame_title": "Dashboard von {{crew}}",
"dashboard_rendering": "Dashboard wird gezeichnet…",
"back_to_roster": "Zurück zu den Crewmates",
"toggle_roster": "Crewmates umschalten",
"fresh_start": "Neu anfangen",
"fresh_start_failed": "Neu anfangen hat nicht geklappt. Das Gespräch ist noch da.",
"fresh_start_confirm_title": "Diesen Crewmate neu anfangen lassen?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/en-XA.json
Original file line number Diff line number Diff line change
Expand Up @@ -13274,7 +13274,7 @@
"dashboard_frame_title": "[Ðàşĥƀøàŕð ƒøŕ {{crew}} ·············]",
"dashboard_rendering": "[Ðŕàẁìñğ ţĥè ðàşĥƀøàŕð… ···············]",
"drawer_delegated_working": "[Ðèĺèğàţèð ẁøŕķ ŕùññìñğ ···············]",
"back_to_roster": "[Ɓàçķ ţø çŕèẁɱàţèş ···············]",
"toggle_roster": "[Ţøğğĺè çŕèẁɱàţèş ··············]",
"fresh_start": "[Ƒŕèşĥ şţàŕţ ··········]",
"fresh_start_failed": "[Ƒŕèşĥ şţàŕţ ðìðñ'ţ ƒìñìşĥ. Ţĥè çøñṽèŕşàţìøñ ẁàş ķèþţ. ···················]",
"fresh_start_confirm_title": "[Ğìṽè ţĥìş çŕèẁɱàţè à ƒŕèşĥ şţàŕţ? ·················]",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/en.manual.json
Original file line number Diff line number Diff line change
Expand Up @@ -8473,7 +8473,7 @@
},
"membersPage": {
"drawer_delegated_working": "Delegated work running",
"back_to_roster": "Back to crewmates",
"toggle_roster": "Toggle crewmates",
"fresh_start": "Fresh start",
"fresh_start_failed": "Fresh start didn't finish. The conversation was kept.",
"fresh_start_confirm_title": "Give this crewmate a fresh start?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -18250,7 +18250,7 @@
"dashboard_render_error": "No se pudo dibujar este panel.",
"dashboard_frame_title": "Panel de {{crew}}",
"dashboard_rendering": "Dibujando el panel…",
"back_to_roster": "Volver a los compañeros",
"toggle_roster": "Mostrar u ocultar compañeros",
"fresh_start": "Empezar de cero",
"fresh_start_failed": "No se pudo empezar de cero. La conversación sigue igual.",
"fresh_start_confirm_title": "¿Que este compañero empiece de cero?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -18250,7 +18250,7 @@
"dashboard_render_error": "Ce tableau de bord n'a pas pu etre dessine.",
"dashboard_frame_title": "Tableau de bord de {{crew}}",
"dashboard_rendering": "Affichage du tableau de bord…",
"back_to_roster": "Retour aux coéquipiers",
"toggle_roster": "Afficher/masquer les coéquipiers",
"fresh_start": "Repartir à zéro",
"fresh_start_failed": "Impossible de repartir à zéro. La conversation est conservée.",
"fresh_start_confirm_title": "Faire repartir ce coéquipier à zéro ?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -17991,7 +17991,7 @@
"dashboard_render_error": "यह डैशबोर्ड ड्रॉ नहीं हो सका।",
"dashboard_frame_title": "{{crew}} का डैशबोर्ड",
"dashboard_rendering": "डैशबोर्ड बनाया जा रहा है…",
"back_to_roster": "साथियों की सूची पर वापस",
"toggle_roster": "साथियों की सूची दिखाएँ/छिपाएँ",
"fresh_start": "नई शुरुआत",
"fresh_start_failed": "नई शुरुआत पूरी नहीं हुई। बातचीत बची हुई है।",
"fresh_start_confirm_title": "इस साथी को नई शुरुआत दो?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -18250,7 +18250,7 @@
"dashboard_render_error": "Non e stato possibile disegnare questa dashboard.",
"dashboard_frame_title": "Dashboard di {{crew}}",
"dashboard_rendering": "Disegno della dashboard…",
"back_to_roster": "Torna ai compagni",
"toggle_roster": "Attiva/disattiva i compagni",
"fresh_start": "Ricomincia da capo",
"fresh_start_failed": "Non è stato possibile ricominciare da capo. La conversazione è rimasta.",
"fresh_start_confirm_title": "Far ricominciare questo compagno da capo?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -17732,7 +17732,7 @@
"dashboard_render_error": "このダッシュボードを描画できませんでした。",
"dashboard_frame_title": "{{crew}} のダッシュボード",
"dashboard_rendering": "ダッシュボードを描画中…",
"back_to_roster": "クルーメイト一覧に戻る",
"toggle_roster": "クルーメイト一覧の表示を切り替え",
"fresh_start": "リセットして再開",
"fresh_start_failed": "リセットできませんでした。会話はそのままです。",
"fresh_start_confirm_title": "このクルーメイトをリセットして再開しますか?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -17732,7 +17732,7 @@
"dashboard_render_error": "이 대시보드를 그릴 수 없습니다.",
"dashboard_frame_title": "{{crew}}의 대시보드",
"dashboard_rendering": "대시보드 그리는 중…",
"back_to_roster": "크루메이트 목록으로",
"toggle_roster": "크루메이트 목록 표시 전환",
"fresh_start": "새로 시작",
"fresh_start_failed": "새로 시작하지 못했어요. 대화는 그대로예요.",
"fresh_start_confirm_title": "이 크루메이트를 새로 시작할까요?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -18250,7 +18250,7 @@
"dashboard_render_error": "Nao foi possivel desenhar este painel.",
"dashboard_frame_title": "Painel de {{crew}}",
"dashboard_rendering": "Desenhando o painel…",
"back_to_roster": "Voltar aos colegas",
"toggle_roster": "Alternar colegas",
"fresh_start": "Começar do zero",
"fresh_start_failed": "Não deu para começar do zero. A conversa foi mantida.",
"fresh_start_confirm_title": "Fazer este colega começar do zero?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -18509,7 +18509,7 @@
"dashboard_render_error": "Не удалось отрисовать эту панель.",
"dashboard_frame_title": "Панель {{crew}}",
"dashboard_rendering": "Отрисовка панели...",
"back_to_roster": "Назад к напарникам",
"toggle_roster": "Показать или скрыть напарников",
"fresh_start": "Начать заново",
"fresh_start_failed": "Не получилось начать заново. Разговор сохранён.",
"fresh_start_confirm_title": "Начать с этим напарником заново?",
Expand Down
2 changes: 1 addition & 1 deletion website/src/i18n/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -17732,7 +17732,7 @@
"dashboard_render_error": "无法绘制该仪表板。",
"dashboard_frame_title": "{{crew}} 的仪表板",
"dashboard_rendering": "正在绘制仪表板…",
"back_to_roster": "返回队友列表",
"toggle_roster": "切换队友列表",
"fresh_start": "重新开始",
"fresh_start_failed": "重新开始没有完成,对话已保留。",
"fresh_start_confirm_title": "让这位队友重新开始吗?",
Expand Down
63 changes: 63 additions & 0 deletions website/src/lib/widgetSrcdoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,56 @@ const CLIPBOARD_FALLBACK_SHIM_BODY = `(function(){
* popups are already allowed); it is a usability fix for the
* frame-replaced-by-login-page case.
*/
/**
* Touch relay: reports this frame's single-finger touches to the parent, so a
* host's drawer gesture can follow a drag that began over the frame.
*
* A touch that lands on an iframe is delivered to the frame's own document and
* never reaches the host page, so a host panel holding a full-width frame (the
* phone Crewmates side panel's Dashboard) had nowhere a closing drag could start.
* The relay posts `{type: 'mc-frame-touch', phase, x, y}` in frame coordinates;
* the host maps them onto the frame element and decides what, if anything, they
* mean.
*
* It stands down for a touch the frame's own content owns -- inside a
* horizontally scrollable element, an editable, or an active text selection --
* the same deference the host gesture applies to its own DOM. Passive listeners:
* the frame keeps scrolling exactly as before. Not a security boundary: any
* script in the frame can post the same shape, so a host must treat the
* messages as untrusted (accept them only from the frame's window, only while
* the gesture they can drive is harmless).
*/
const FRAME_TOUCH_RELAY_BODY = `(function(){
function scrollsX(n){
for(;n&&n.nodeType===1;n=n.parentElement){
if(n.scrollWidth-n.clientWidth>1){var o=getComputedStyle(n).overflowX;if(o==='auto'||o==='scroll')return true;}
}
return false;
}
function editable(n){
for(;n&&n.nodeType===1;n=n.parentElement){
if(n.isContentEditable||n.tagName==='INPUT'||n.tagName==='TEXTAREA'||n.tagName==='SELECT')return true;
}
return false;
}
var on=false;
function send(phase,e){
var t=(e.touches&&e.touches[0])||(e.changedTouches&&e.changedTouches[0]);
if(!t)return;
parent.postMessage({type:'mc-frame-touch',phase:phase,x:t.clientX,y:t.clientY},'*');
}
var opts={passive:true,capture:true};
window.addEventListener('touchstart',function(e){
if(on&&e.touches.length>1){send('cancel',e);on=false;return;}
var sel=window.getSelection?window.getSelection():null;
on=e.touches.length===1&&!scrollsX(e.target)&&!editable(e.target)&&!(sel&&!sel.isCollapsed);
if(on)send('start',e);
},opts);
window.addEventListener('touchmove',function(e){if(on)send('move',e);},opts);
window.addEventListener('touchend',function(e){if(on){on=false;send('end',e);}},opts);
window.addEventListener('touchcancel',function(e){if(on){on=false;send('cancel',e);}},opts);
})();`

const EXTERNAL_LINK_TARGET_SHIM_BODY = `(function(){
window.addEventListener('click', function(e){
var path = typeof e.composedPath === 'function' ? e.composedPath() : null;
Expand Down Expand Up @@ -934,6 +984,10 @@ interface BuildSrcdocOptions {
* `allow-popups`: there a `_blank` link is a blocked popup (a dead click),
* so in-frame navigation must be left alone. */
rewriteBareLinks?: boolean
/** Report the frame's touches to the parent (see FRAME_TOUCH_RELAY_BODY), for
* a host whose drawer gesture must be able to start over the frame. Off by
* default: nothing else listens for them. */
relayTouches?: boolean
}

/** Build the srcdoc HTML for a sandboxed widget iframe. The LLM `html`
Expand All @@ -950,6 +1004,7 @@ export function buildSrcdoc({
loadingLabel = '',
rewriteBareLinks = true,
offlineScripts = false,
relayTouches = false,
}: BuildSrcdocOptions): string {
// A widget hardcoded for a light canvas renders on a light canvas even when
// the dashboard is dark -- see resolveWidgetTheme. Resolved once here so the
Expand Down Expand Up @@ -1080,6 +1135,14 @@ export function buildSrcdoc({
body.appendChild(linkTargetShim)
}

// Touch relay (see FRAME_TOUCH_RELAY_BODY), ahead of the LLM html so its
// capture-phase listeners are registered first. textContent assignment only.
if (relayTouches) {
const touchRelay = doc.createElement('script')
touchRelay.textContent = FRAME_TOUCH_RELAY_BODY
body.appendChild(touchRelay)
}

// Parse LLM html into a document fragment via the typed DOM API. The
// `html` argument flows through createContextualFragment() — NOT through
// string concatenation — so it never enters a template-literal HTML build.
Expand Down
4 changes: 4 additions & 0 deletions website/src/pages/members/CrewDynamicDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,8 @@ export default function CrewDynamicDashboard({ target, displayName, onAct, previ
mode: theme,
rewriteBareLinks: false,
offlineScripts: true,
// The phone side panel's closing drag starts over this frame.
relayTouches: true,
})
: null,
[shown, isError, themeVars, theme],
Expand Down Expand Up @@ -332,6 +334,8 @@ export default function CrewDynamicDashboard({ target, displayName, onAct, previ
mode: theme,
rewriteBareLinks: false,
offlineScripts: true,
// The phone side panel's closing drag starts over this frame.
relayTouches: true,
})
: null,
[probating, candidate, isError, themeVars, theme],
Expand Down
3 changes: 2 additions & 1 deletion website/src/pages/members/CrewWebview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1104,7 +1104,8 @@ function CrewDashboardFrameView({ slug, member, displayName, avatar, onAct, onOp
const srcdoc = useMemo(
() =>
html && !isError
? buildSrcdoc({ html, themeVars, mode: theme, rewriteBareLinks: false })
// relayTouches: the phone side panel's closing drag starts over this frame.
? buildSrcdoc({ html, themeVars, mode: theme, rewriteBareLinks: false, relayTouches: true })
: null,
[html, isError, themeVars, theme],
);
Expand Down
30 changes: 0 additions & 30 deletions website/src/pages/members/MembersPage.filters.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -522,36 +522,6 @@ describe('MembersPage hides unlisted crewmates', () => {
expect(screen.queryByTestId('crewmate-empty-hero')).toBeNull()
})

it('below md, a roster whose every row is hidden names the search instead of an empty list', async () => {
const own = Object.getOwnPropertyDescriptor(window, 'matchMedia')
window.matchMedia = vi.fn().mockImplementation((q: string) => ({
matches: /max-width/.test(q),
media: q,
onchange: null,
addListener: vi.fn(),
removeListener: vi.fn(),
addEventListener: vi.fn(),
removeEventListener: vi.fn(),
dispatchEvent: vi.fn(),
}))
try {
;(api.defaultAgent as ReturnType<typeof vi.fn>).mockResolvedValue({ default_agent: '' })
;(api.members as ReturnType<typeof vi.fn>).mockResolvedValue({
members: [row('pkg-tool', { ...NO }), row('legacy-aim', { source: 'aim', ...NO })],
})
// Below md a bare visit is the roster.
renderWithProviders(<MembersPage />, { route: '/members' })
expect(await screen.findByTestId('member-all-hidden')).toBeTruthy()
expect(names()).toEqual([])
fireEvent.change(screen.getByTestId('member-search'), { target: { value: 'pkg' } })
expect(screen.queryByTestId('member-all-hidden')).toBeNull()
expect(names()).toEqual(['pkg-tool'])
} finally {
if (own) Object.defineProperty(window, 'matchMedia', own)
else delete (window as unknown as { matchMedia?: typeof window.matchMedia }).matchMedia
}
})

it('the default-crew failure notice hands the agent the journal report, not just its localized copy', async () => {
;(api.defaultAgent as ReturnType<typeof vi.fn>).mockRejectedValue(new Error('Forbidden'))
await renderPage(MIXED)
Expand Down
Loading
Loading