All files / src/objects Turn.tsx

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
import type { ChatCommandRecord } from "@/objects/ChatCommand";
import type { AttachmentRef } from "@/objects/Model";
 
/**
 * A chat turn still running on the server, as svc-core lists it
 * (`GET /app/turns`, `app/services/turns.py`). A turn runs to its end and is
 * stored whether or not anyone is on the page, so a chat page opened while
 * one runs shows it — and reads the conversation again once it has gone,
 * since svc-core lists a turn until it is stored.
 */
 
export type TurnKind = "agent" | "model";
export type TurnStatus = "running" | "awaiting_input";
 
/** What a running turn's message records. */
export interface RunningTurnMeta {
  /** The chat command it ran. */
  command?: ChatCommandRecord;
  /** The documents it attached. */
  attachments?: AttachmentRef[];
}
 
export interface RunningTurn {
  id: string;
  kind: TurnKind;
  /** The agent or model answering. */
  target_id: string;
  /** Where the answer will be stored: an existing conversation, or the id a
   *  new one will have. */
  conversation_id: string;
  status: TurnStatus;
  started_at: string;
  /** The person's message as it will be stored; null until the input rules
   *  have run. */
  prompt: string | null;
  /** What the message records. */
  meta: RunningTurnMeta | null;
  /** Stop was asked for and the turn is winding down. */
  stopping: boolean;
}