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.

Browser step card: a closed card stops saying it needs you (22p) (#729)

Oleksandr Ivanchenko30334c9c5f88
diff --git a/frontend/src/components/HumanStepCard.tsx b/frontend/src/components/HumanStepCard.tsx
index ff7d7f9a..2a467652 100644
--- a/frontend/src/components/HumanStepCard.tsx
+++ b/frontend/src/components/HumanStepCard.tsx
@@ -97,10 +97,12 @@ export const HumanStepCard: React.FC<HumanStepCardProps> = ({ meta, messageId, k
<ModernAvatar role={kwantName} name={kwantName} size={34} kwantId={kwantId} />
<div className={`flex-1 min-w-0 max-w-2xl rounded-2xl rounded-tl-sm border bg-zinc-900/60 shadow-sm ${open ? 'border-amber-500/40' : 'border-zinc-800'}`}>
<div className="px-4 pt-3 pb-2 space-y-1">
- {/* One run of text, so on a phone it wraps like a sentence instead of into columns. */}
- <p data-hs-meta="" className="text-[11px] font-medium text-zinc-400 leading-snug break-words">
- <Hand size={12} className="shrink-0 inline-block align-[-2px] mr-1.5 text-amber-300" aria-hidden="true" />
- <span className="text-zinc-200">{kwantName}</span> needs you in the browser
+ {/* One run of text, so on a phone it wraps like a sentence instead of into columns.
+ Once the step is closed it says what was asked, quietly, and the footer says what happened. */}
+ <p data-hs-meta="" className={`text-[11px] font-medium leading-snug break-words ${open ? 'text-zinc-400' : 'text-zinc-500'}`}>
+ <Hand size={12} className={`shrink-0 inline-block align-[-2px] mr-1.5 ${open ? 'text-amber-300' : 'text-zinc-500'}`} aria-hidden="true" />
+ <span className={open ? 'text-zinc-200' : 'text-zinc-400'}>{kwantName}</span>
+ {open ? ' needs you in the browser' : ' asked for you in the browser'}
{view.source === 'auto' && ' · spotted automatically'}
</p>
<h3 id={headingId} className="text-sm font-semibold text-zinc-100">
diff --git a/frontend/tests/humanSteps.test.mjs b/frontend/tests/humanSteps.test.mjs
index 868609d7..49a2f642 100644
--- a/frontend/tests/humanSteps.test.mjs
+++ b/frontend/tests/humanSteps.test.mjs
@@ -90,6 +90,31 @@ test('meta line is one inline text run that wraps like a sentence', () => {
assert.match(bot, /<span class="text-zinc-200">Pixel<\/span> needs you in the browser$/);
});
+test('a closed card stops asking: quiet past-tense eyebrow in zinc, never "needs you" (22p)', () => {
+ const eyebrow = (html) => html.match(/<p data-hs-meta="" class="([^"]*)">([^]*?)<\/p>/);
+ // Open: unchanged, amber hand, "needs you"
+ const open = eyebrow(ui.render(props({ meta: h.parseHumanStepMeta(meta({ source: 'auto' })) })));
+ assert.match(open[2], /^<svg[^>]*lucide-hand[^>]*text-amber-300[^]*?<\/svg><span class="text-zinc-200">Pixel<\/span> needs you in the browser · spotted automatically$/);
+ // Every closed status, from the live record and from the saved message; left_for_message comes with #721
+ for (const status of ['done', 'declined', 'timed_out', 'resolved_auto', 'cancelled', 'left_for_message']) {
+ for (const [how, p] of [
+ ['live', props({ live: rec({ status }) })],
+ ['live, auto', props({ meta: h.parseHumanStepMeta(meta({ source: 'auto' })), live: rec({ status }) })],
+ ...(status === 'left_for_message' ? [] : [['meta', props({ meta: h.parseHumanStepMeta(meta({ status })) })]]),
+ ]) {
+ const html = ui.render(p);
+ const m = eyebrow(html);
+ assert.ok(m, `${status} ${how}: eyebrow`);
+ assert.doesNotMatch(html, /needs you/i, `${status} ${how}: never "needs you"`);
+ assert.doesNotMatch(m[0], /amber/, `${status} ${how}: no amber in the eyebrow`);
+ assert.match(m[1], /text-zinc-500/);
+ const auto = how.endsWith('auto') ? ' · spotted automatically' : '';
+ assert.match(m[2], new RegExp(`^<svg[^>]*lucide-hand[^>]*text-zinc-500[^]*?</svg><span class="text-zinc-400">Pixel</span> asked for you in the browser${auto}$`), `${status} ${how}`);
+ assert.match(html, /border-zinc-800/, `${status} ${how}: quiet border`);
+ }
+ }
+});
+
test('captcha card after the turn ended: one line, carries on by itself, not "stopped waiting"', () => {
const html = ui.render(props({ waiting: false, meta: h.parseHumanStepMeta(meta({ step_kind: 'captcha' })) }));
assert.match(html, /role="status" aria-live="polite"[^>]*><span[^>]*><svg[^]*?<\/svg> Pixel carries on by itself once it’s solved\. Nothing you do there is passed to Pixel\.<\/span><\/p>/);