All files / src/objects ChatCommand.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                                                                                                                                     
import type { RunField } from "@/objects/Skill";
 
/**
 * Chat commands — `/<action> <kind> <target> [request]` — as svc-core serves
 * them (`GET /app/agents/{id}/commands`, `app/services/chat_commands.py`).
 * The catalogue is the only list of commands: the palette completes from it,
 * and the server parses and checks every command whatever the client sent.
 */
 
/** The fields a target takes — for a skill, its standalone Run form's
 *  (its run schema), drawn under the command in the chat. */
export interface ChatCommandForm {
  fields: RunField[];
  /** The free text after the command: required for a target with no fields,
   *  optional additional instructions for one with some. */
  request: "required" | "optional";
  /** False when a worker's interface could not be looked up. */
  complete: boolean;
}
 
/** Something a command can act on in this chat (a skill, for `/execute skill`). */
export interface ChatCommandTarget {
  id: string;
  /** What the command line names it by: `research-brief`. */
  slug: string;
  name: string;
  description: string;
  built_in: boolean;
  /** What it takes; null for free text only. */
  form?: ChatCommandForm | null;
}
 
/** One command: an action on a kind of resource, with its targets here. */
export interface ChatCommandSpec {
  action: string;
  kind: string;
  /** Short, for the palette: "Run a skill". */
  label: string;
  description: string;
  /** What the request after the target is for. */
  request_hint: string;
  request_required: boolean;
  /** `/execute skill <skill> <request>`. */
  usage: string;
  targets: ChatCommandTarget[];
}
 
export interface ChatCommandCatalogue {
  commands: ChatCommandSpec[];
}
 
/** What a user's message keeps about the command it ran — svc-core's
 *  `ParsedCommand.meta()`, on the stored message's `meta.command`. */
export interface ChatCommandRecord {
  /** The command as typed, without the request: `/execute skill research-brief`. */
  line: string;
  action: string;
  kind: string;
  target_id: string;
  target_name: string;
  /** The form's values, as the skill was given them (redacted like the
   *  prompt). */
  inputs?: Record<string, unknown>;
  /** The free text after the command. */
  request?: string;
}