Files
learnharness/components/queued-steers.tsx
T
amosblomqvist 5271ca0e4a composer steering: the general steering machinery (owner arc 2026-10-03)
STEERING, NOT FOLLOW-UPS — pi-agent-core's two rails, used deliberately:
agent.steer() injects at the next response boundary INSIDE the live run
(one logical turn, the model changes course); followUp() would only extend
an ended run — not built. The same rail job markers already ride
(steeringMode 'all', the 2026-09-26 doctrine).

- POST /api/chats/[id]/steer: 404/400 honest guards; no live turn → 409
  and the client silently falls back to a plain text send (the settle
  race); live → steerLiveChat hands the message to the live agent's
  steering queue AND parks it in the userSteers registry — the stranding
  safety net. A steer stranded behind a question termination or abort
  stays parked and rides the chat's NEXT run (handOffEligible), the same
  deliver-or-requeue lifecycle as job markers. Reconciliation at settle:
  delivered ids drop (reconcileUserSteers).
- Client: steer(text) queues + POSTs without flipping any turn state;
  the drain's verbatim message events upsert the real user card by the
  client-minted id (steer_<localid>) and the indicator fold drops the
  line. canSend no longer gates on turnInFlight — Enter mid-turn steers;
  Enter with an empty composer still stops; the square button stays Stop.
- The queued-steer indicator (owner spec): quiet one-liners above the
  composer shell — right-aligned to where its corner rounding starts,
  truncated with an ellipsis, fixed max width, ~half opacity, no
  background, no container. Tunable later.
- Verified from pi-agent-core source: steering drains per completed turn
  inside the loop; injected messages emit message_start/end verbatim;
  finishTurn {action:'end'} (our question stopper) exits BEFORE the
  steering poll — hence the registry.
2026-10-03 03:01:51 +03:00

37 lines
1.3 KiB
TypeScript

/**
* THE QUEUED-STEER INDICATOR (owner spec 2026-10-03): steers sent but not
* yet drained render as quiet one-liners ABOVE the composer shell —
* right-aligned to where the shell's corner rounding starts, truncated
* with an ellipsis, no background, no container, roughly half opacity.
* Visible but very quiet; layout tunable later.
*
* A line dies the moment its card lands in the transcript: the drain's
* verbatim message events upsert the real user card by the client-minted
* id, and visibleQueuedSteers (session-core, pure) filters the queue
* against the message ids. A steer parked server-side (stranded behind a
* question) keeps its line — an honest "waiting for the next run".
*/
export interface QueuedSteerLine {
id: string;
text: string;
}
/** The pure body (SSR-pinnable): one right-aligned truncated line per
* queued steer, stacked. */
export function QueuedSteersBody({ steers }: { steers: QueuedSteerLine[] }) {
if (steers.length === 0) return null;
return (
<div className="flex flex-col items-end gap-0.5 pb-1 pr-4" data-testid="queued-steers">
{steers.map((s) => (
<span
key={s.id}
title={s.text}
className="block max-w-[240px] truncate font-ui text-[11px] text-muted-foreground/60"
>
{s.text}
</span>
))}
</div>
);
}