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.

23d: a closed browser card always says what's next (#756)

Oleksandr Ivanchenko6c14423b31cf
diff --git a/frontend/src/components/HumanStepCard.tsx b/frontend/src/components/HumanStepCard.tsx
index 30cdf552..26b30c52 100644
--- a/frontend/src/components/HumanStepCard.tsx
+++ b/frontend/src/components/HumanStepCard.tsx
@@ -56,7 +56,7 @@ export const HumanStepCard: React.FC<HumanStepCardProps> = ({ meta, messageId, k
</span>
) : status === 'timed_out' ? (
<span className="inline-flex items-center gap-1.5 text-zinc-400">
- <Clock size={13} className="shrink-0" aria-hidden="true" /> Nobody solved it in time. {kwantName} moved on without it.
+ <Clock size={13} className="shrink-0" aria-hidden="true" /> Nobody solved it in time. {kwantName} moved on without it. If you finished, say so in the chat.
</span>
) : status === 'done' ? (
<span className="inline-flex items-center gap-1.5 text-emerald-300">
@@ -70,6 +70,11 @@ export const HumanStepCard: React.FC<HumanStepCardProps> = ({ meta, messageId, k
<span className="inline-flex items-center gap-1.5 text-zinc-400">
<MinusCircle size={13} className="shrink-0" aria-hidden="true" /> Closed: the reply was stopped.
</span>
+ ) : !open ? (
+ // A closed status this card has no line for (a newer server's): say it's closed, never "Press Done" with no Done button (23d)
+ <span className="inline-flex items-center gap-1.5 text-zinc-400">
+ <MinusCircle size={13} className="shrink-0" aria-hidden="true" /> This step is closed.
+ </span>
) : waiting ? (
<span className="inline-flex items-center gap-1.5 text-amber-300">
<Clock size={13} className="shrink-0" aria-hidden="true" /> {kwantName} is paused and waiting for you.
diff --git a/frontend/tests/humanSteps.test.mjs b/frontend/tests/humanSteps.test.mjs
index dd7d475d..fda37e2d 100644
--- a/frontend/tests/humanSteps.test.mjs
+++ b/frontend/tests/humanSteps.test.mjs
@@ -246,3 +246,25 @@ test('a late Done or Skip on a closed step: nothing where the footer says it, wo
assert.equal(h.closedStepText('open', 'done', 'Pixel'), undefined);
assert.equal(h.closedStepText('paused_for_x', 'done', 'Pixel'), 'This step is already closed.');
});
+
+test('a closed card always says what is next: timed_out tells you to say so; an unknown closed status never says "Press Done" (23d)', () => {
+ // timed_out: what to do if you did finish, the same words as left_for_message's late Done
+ for (const kind of ['sign_in', 'captcha', 'two_factor', 'other']) {
+ const html = ui.render(props({ meta: h.parseHumanStepMeta(meta({ step_kind: kind })), live: rec({ kind, status: 'timed_out' }), waiting: false }));
+ assert.match(html, /Nobody solved it in time\. Pixel moved on without it\. If you finished, say so in the chat\./, kind);
+ assert.doesNotMatch(html, /<button/, kind);
+ }
+ // A closed status the card has no line for: the neutral line, no buttons, never the open card's lines, waiting or not
+ for (const kind of ['sign_in', 'captcha', 'two_factor', 'other']) {
+ for (const waiting of [false, true]) {
+ const html = ui.render(props({ meta: h.parseHumanStepMeta(meta({ step_kind: kind })), live: rec({ kind, status: 'left_for_message' }), waiting }));
+ assert.match(html, /<span class="inline-flex items-center gap-1\.5 text-zinc-400"><svg[^>]*lucide-circle-minus[^]*?<\/svg> This step is closed\.<\/span>/, `${kind} waiting=${waiting}`);
+ assert.doesNotMatch(html, /Press Done|stopped waiting|paused and waiting|carries on by itself|<button/, `${kind} waiting=${waiting}`);
+ }
+ }
+ // The open card after the turn ended keeps its pick-it-up-later line and its buttons
+ const open = ui.render(props({ waiting: false, meta: h.parseHumanStepMeta(meta({ step_kind: 'sign_in' })) }));
+ assert.match(open, /stopped waiting\. Press Done any time and it picks up in a new reply\./);
+ assert.match(open, /<button/);
+ assert.doesNotMatch(open, /This step is closed/);
+});