GraphOps are the only valid model output for a StateWeave graph step.
export type GraphOp =
  | { op: "add_node"; node: Omit<GraphNode, "createdAt"> }
  | { op: "add_edge"; from: string; to: string; type: EdgeType }
  | { op: "update_node"; id: string; patch: Partial<GraphNode> }
  | { op: "focus"; currentFocus: string }
  | { op: "call_tool"; tool: string; args: Record<string, unknown> }
  | { op: "final"; answer: string };
The model returns JSON:
{
  "ops": [
    {
      "op": "add_node",
      "node": {
        "id": "hypothesis_1",
        "type": "hypothesis",
        "text": "The login bug may come from refresh token handling before session persistence.",
        "confidence": 0.72,
        "status": "active"
      }
    },
    {
      "op": "call_tool",
      "tool": "read_mock_file",
      "args": { "path": "auth.ts" }
    }
  ]
}
The SDK validates this with Zod before mutating the graph.