Cotton code
16 lines · 975 B · TypeScriptRaw
/** * The memory refusals in the kit's own words: the shipped `refusal` line set * (crates/cotton-core/kits/shell/lines/refusal.json → `memory.*`), read from the * file itself so the sentences cannot drift from the Rust server's. The * personal object keeps no per-database line overrides, so the kit's words are * the words (Rust `shell_lines::resolve` with no rows). */import refusal from "../../../../../../crates/cotton-core/kits/shell/lines/refusal.json";/** One `refusal` line by its dotted key, `{name}` filled; the literal `refusal.<line>` when the kit has none (Rust's fallback). */export function say(line: string, fills: Record<string, string> = {}): string {  let at: unknown = refusal;  for (const key of line.split(".")) at = at && typeof at === "object" ? (at as Record<string, unknown>)[key] : undefined;  if (typeof at !== "string") return `refusal.${line}`;  return at.replace(/\{(\w+)\}/g, (whole, name: string) => fills[name] ?? whole);}