All files / src/objects Review.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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96                                                                                                                                                                                               
/**
 * The governance review queue — everything that needs a person's decision.
 *
 * Three kinds of item land here. An audit rule's `flag_for_review` (which
 * used to leave a trace event inside a conversation and nothing else), an
 * evaluation run that regressed against its last comparable run, and an
 * answer an Output rule withheld — kept here, for the workspace's reviewers,
 * and nowhere the person it was withheld from can read. Each is a governance
 * signal, so a reviewer works them through in one place.
 */
 
/** What raised the item. */
export type ReviewKind = "rule" | "regression" | "withheld";
 
/** A flag's lifecycle. Terminal once resolved — there is no reopen. */
export type ReviewStatus = "pending" | "reviewed" | "dismissed";
 
export interface ReviewFlag {
  id: string;
  owner_user_id?: string | null;
  /** `rule` for an audit flag, `regression` for a regressed evaluation run. */
  kind?: ReviewKind;
 
  /**
   * Rule identity is denormalised onto the flag rather than joined: a rule can
   * be renamed or deleted, and a flag that resolved to nothing is exactly the
   * evidence an audit needs. `rule_version` pins which revision fired.
   */
  rule_id?: string | null;
  rule_name?: string | null;
  rule_version?: number | null;
  scope_type?: string | null;
  scope_id?: string | null;
  /** Who the rule addressed the flag to. */
  reviewer?: string | null;
 
  execution_type?: string | null;
  conversation_id?: string | null;
  agent_id?: string | null;
  ai_model_id?: string | null;
  /** The flagged turn: the id of its decision record. */
  invocation_id?: string | null;
  /** The question the flagged answer was for, as stored (after the policy
   *  rules ran), read from the turn. Null for a regression and for flags from
   *  before turns had ids. */
  question?: string | null;
  /** Post-redaction excerpt, so the queue is legible without opening each
   *  one — for a regression, what moved. */
  excerpt?: string | null;
  /** A `withheld` item's answer, as the turn's other Output rules left it.
   *  Served only by the queue; never on the decision record. */
  withheld_text?: string | null;
  /** A regression's evaluation and the run that regressed. */
  experiment_id?: string | null;
  batch_id?: string | null;
 
  status: ReviewStatus;
  reviewed_by_user_id?: string | null;
  reviewed_at?: string | null;
  reviewer_note?: string | null;
 
  created_at?: string | null;
  /** When retention lets this be purged. Null means keep indefinitely. */
  expires_at?: string | null;
}
 
export interface ReviewFlagList {
  flags: ReviewFlag[];
  total: number;
}
 
export interface ReviewSummary {
  pending: number;
  reviewed: number;
  dismissed: number;
  total: number;
}
 
/** A reviewer's decision. Only these two — a flag cannot be set back to pending. */
export type ReviewDecision = "reviewed" | "dismissed";
 
export interface ReviewQuery {
  status?: ReviewStatus;
  kind?: ReviewKind;
  /** Free-text match over the rule name, reviewer and excerpt. Applied by the
   *  server: the client holds one page, so filtering here would answer "is it
   *  on this page" while looking like it searched the queue. */
  q?: string;
  reviewer?: string;
  rule_id?: string;
  agent_id?: string;
  since?: string;
  limit?: number;
  offset?: number;
}