Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49c3b86dfd | ||
|
|
b753ec2093 |
2 changed files with 35 additions and 0 deletions
|
|
@ -25,6 +25,7 @@ import { fmtAge, fmtTokens } from './lib/format.js';
|
||||||
import { resolveDashboardBase } from './lib/dashboardBase.js';
|
import { resolveDashboardBase } from './lib/dashboardBase.js';
|
||||||
import { submitPauseResume } from './lib/pauseAction.js';
|
import { submitPauseResume } from './lib/pauseAction.js';
|
||||||
import { postModel, postEffort } from './lib/modelEffort.js';
|
import { postModel, postEffort } from './lib/modelEffort.js';
|
||||||
|
import { postCancelTurn } from './lib/termActions.js';
|
||||||
import type { TokenUsage } from './types.js';
|
import type { TokenUsage } from './types.js';
|
||||||
|
|
||||||
type OpenPanel = 'inbox' | 'todos' | null;
|
type OpenPanel = 'inbox' | 'todos' | null;
|
||||||
|
|
@ -153,6 +154,8 @@ export function Root() {
|
||||||
onSelectEffort={() => {}}
|
onSelectEffort={() => {}}
|
||||||
paused={false}
|
paused={false}
|
||||||
onTogglePause={() => {}}
|
onTogglePause={() => {}}
|
||||||
|
thinking={false}
|
||||||
|
onCancelTurn={() => Promise.resolve()}
|
||||||
/>
|
/>
|
||||||
</Header>
|
</Header>
|
||||||
<main className="agent-main">
|
<main className="agent-main">
|
||||||
|
|
@ -206,6 +209,13 @@ export function Root() {
|
||||||
() => refresh(),
|
() => refresh(),
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
|
thinking={effectiveTurnState === 'thinking'}
|
||||||
|
onCancelTurn={() =>
|
||||||
|
postCancelTurn().then((r) => {
|
||||||
|
if (!r.ok) liveStreamRef.current?.pushNote(`✗ /cancel failed${r.detail ? ': ' + r.detail : ''}`);
|
||||||
|
refresh();
|
||||||
|
})
|
||||||
|
}
|
||||||
/>
|
/>
|
||||||
</Header>
|
</Header>
|
||||||
<main className="agent-main">
|
<main className="agent-main">
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ export interface StatusChipsProps {
|
||||||
paused: boolean;
|
paused: boolean;
|
||||||
onTogglePause: () => void;
|
onTogglePause: () => void;
|
||||||
lastTurnLabel?: string;
|
lastTurnLabel?: string;
|
||||||
|
thinking: boolean;
|
||||||
|
onCancelTurn: () => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const MODEL_DESCRIPTIONS: Record<string, string> = {
|
const MODEL_DESCRIPTIONS: Record<string, string> = {
|
||||||
|
|
@ -100,7 +102,17 @@ export function StatusChips({
|
||||||
paused,
|
paused,
|
||||||
onTogglePause,
|
onTogglePause,
|
||||||
lastTurnLabel,
|
lastTurnLabel,
|
||||||
|
thinking,
|
||||||
|
onCancelTurn,
|
||||||
}: StatusChipsProps) {
|
}: StatusChipsProps) {
|
||||||
|
// `.finally()` on the caller's promise (not a `thinking`-flip effect):
|
||||||
|
// re-enables the button once the request actually settles, success or
|
||||||
|
// failure alike — ported from app.js's original
|
||||||
|
// `postCancelTurn().finally(() => { btn.disabled = false; })`. A
|
||||||
|
// `thinking`-only reset would leave the button stuck disabled on a
|
||||||
|
// failed request (argus, PR review): the turn is still in flight, so
|
||||||
|
// `thinking` never flips to trigger a reset.
|
||||||
|
const [cancelBusy, setCancelBusy] = useState(false);
|
||||||
return (
|
return (
|
||||||
<div class="status-chips">
|
<div class="status-chips">
|
||||||
<Badge value={aliveLabel} tone={aliveTone} />
|
<Badge value={aliveLabel} tone={aliveTone} />
|
||||||
|
|
@ -141,6 +153,19 @@ export function StatusChips({
|
||||||
onClick={onTogglePause}
|
onClick={onTogglePause}
|
||||||
/>
|
/>
|
||||||
{lastTurnLabel ? <span class="status-chips-last-turn">{lastTurnLabel}</span> : null}
|
{lastTurnLabel ? <span class="status-chips-last-turn">{lastTurnLabel}</span> : null}
|
||||||
|
{thinking ? (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn-cancel-turn"
|
||||||
|
disabled={cancelBusy}
|
||||||
|
onClick={() => {
|
||||||
|
setCancelBusy(true);
|
||||||
|
onCancelTurn().finally(() => setCancelBusy(false));
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
■ cancel turn
|
||||||
|
</button>
|
||||||
|
) : null}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue