File size: 664 Bytes
0427fad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import { extractSyscalls, Syscall } from "./syscall.js";

export type NormalizedModelOutput = {
  raw: string;
  decision: string;
  assumptions: string[];
  syscalls: Syscall[];
  requestedTools: Syscall[];
  uncertainty: "NONE" | "SPEC" | "OBLIGATION";
};

export function normalizeModelOutput(raw: string): NormalizedModelOutput {
  const syscalls = extractSyscalls(raw);

  const uncertainty =
    raw.includes("OBLIGATION") ? "OBLIGATION" :
    raw.includes("SPEC") ? "SPEC" :
    "NONE";

  return {
    raw,
    decision: raw.slice(0, 500),
    assumptions: [],
    syscalls,
    requestedTools: syscalls,
    uncertainty
  };
}