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.

Human check card: one line once the turn ended, meta line wraps as text (#302)

Oleksandr Ivanchenko57098c2d42d1
diff --git a/frontend/src/components/HumanStepCard.tsx b/frontend/src/components/HumanStepCard.tsx
index cb3a1476..ce7915c5 100644
--- a/frontend/src/components/HumanStepCard.tsx
+++ b/frontend/src/components/HumanStepCard.tsx
@@ -75,8 +75,9 @@ export const HumanStepCard: React.FC<HumanStepCardProps> = ({ meta, messageId, k
</span>
) : captcha ? (
// The turn ended, but the step's watcher still resumes the bot once the puzzle clears.
+ // This one line also carries the privacy note, so there is no footer under it.
<span className="inline-flex items-center gap-1.5 text-zinc-400">
- <Clock size={13} aria-hidden="true" /> {kwantName}’s turn ended. It continues by itself once the puzzle is solved.
+ <Clock size={13} aria-hidden="true" /> {kwantName} carries on by itself once it’s solved. Nothing you do there is passed to {kwantName}.
</span>
) : (
<span className="inline-flex items-center gap-1.5 text-zinc-400">
@@ -95,11 +96,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">
- <span className="flex items-center gap-1.5 text-[11px] font-medium text-zinc-400">
- <Hand size={12} className="text-amber-300" aria-hidden="true" />
+ {/* 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="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
- {view.source === 'auto' && <span className="text-zinc-400">· spotted automatically</span>}
- </span>
+ {view.source === 'auto' && ' · spotted automatically'}
+ </p>
<h3 id={headingId} className="text-sm font-semibold text-zinc-100">
{text.heading}
</h3>
@@ -160,7 +162,7 @@ export const HumanStepCard: React.FC<HumanStepCardProps> = ({ meta, messageId, k
<p role="status" aria-live="polite" className="min-w-0">
{line}
</p>
- {open && captcha && (
+ {open && captcha && waiting && (
<p className="basis-full text-zinc-400">Solve the puzzle and {kwantName} continues by itself. Nothing you do there is passed to {kwantName}.</p>
)}
{open && !captcha && <p className="basis-full text-zinc-400">Open the browser and do it there, then press Done. What you type into fields there isn’t passed to {kwantName}.</p>}
diff --git a/frontend/tests/humanSteps.test.mjs b/frontend/tests/humanSteps.test.mjs
index 503850a9..dbafb94b 100644
--- a/frontend/tests/humanSteps.test.mjs
+++ b/frontend/tests/humanSteps.test.mjs
@@ -78,9 +78,24 @@ test('closed and stale cards', () => {
assert.match(ui.render(props({ meta: h.parseHumanStepMeta(meta({ source: 'auto' })) })), /spotted automatically/);
});
-test('captcha card after the turn ended: continues by itself, not "stopped waiting"', () => {
+test('meta line is one inline text run that wraps like a sentence', () => {
+ const html = ui.render(props({ meta: h.parseHumanStepMeta(meta({ source: 'auto' })) }));
+ const m = html.match(/<p data-hs-meta=""([^>]*)>([^]*?)<\/p>/);
+ assert.ok(m, 'meta paragraph');
+ // Not a flex row of columns
+ assert.doesNotMatch(m[1], /\bflex\b|inline-flex/);
+ // Icon inline, then name, then the rest as plain text in the same run
+ assert.match(m[2], /^<svg[^>]*class="[^"]*inline-block[^"]*"[^]*?<\/svg><span class="text-zinc-200">Pixel<\/span> needs you in the browser · spotted automatically$/);
+ const bot = ui.render(props()).match(/<p data-hs-meta=""[^>]*>([^]*?)<\/p>/)[1];
+ assert.match(bot, /<span class="text-zinc-200">Pixel<\/span> needs you in the browser$/);
+});
+
+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, /Pixel’s turn ended\. It continues by itself once the puzzle is solved\./);
+ 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>/);
+ // The near-duplicate footer is gone: the privacy note is said once, and nothing else sits under the line
+ assert.equal((html.match(/Nothing you do there is passed/g) || []).length, 1);
+ assert.doesNotMatch(html, /turn ended|Solve the puzzle and|continues by itself/);
assert.doesNotMatch(html, /stopped waiting|instantly/);
// Other kinds keep the pick-it-up-later copy
assert.match(ui.render(props({ waiting: false, meta: h.parseHumanStepMeta(meta({ step_kind: 'sign_in' })) })), /stopped waiting\. Press Done any time/);